Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having some trouble to make GA Custom variables work on my website. After following all the tutorials, seeking documentation, debugging with Firebug, I cannont understand what is wrong with my code...

Here is the test page I wrote, to have a very targeted test case:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Custom variable test</title>
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-13048570-1']);
    <script type="text/javascript">
    <h1>Hello on my custom variable test!</h1>
    <script type="text/javascript">
        (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();

My problem is that the custom variables never reach Google Analytics. I've installed the Google Analytics debugger found here (http://www.keithclark.co.uk/labs/google-analytics-debugger/) for Firefox; and when submitting my page, it shows me that two custom variables are set but the name and value are empty; despite the fact that the generated GIF has utme parameter inline (utme 8(pageName*secondCustomVar)9(testCustomVar*testValue)).


I really have no more ideas why this is not working.

share|improve this question

migrated from stackoverflow.com Dec 16 '13 at 16:47

This question came from our site for professional and enthusiast programmers.

I removed my obviously dumb answer (the scope parameter is even called opt_scope in the docs, which is kind of a giveaway :-) ). So next question would be, how long did you wait ? Custom vars are one of those things that take between 4 to 48 hours to appear (if you account has more then 200 000 hits per day it will be updated only once a day according to documentation), so the info might not be processed yet. – Eike Pierstorff Dec 13 '13 at 14:43
I just tough a little bit about that ; and indeed ; when almost every data is available very quickly, it seems that custom variables do have a certain lag... So, next step will be to create a new test case with a unused slot, on an unused page, and test again... – Romain VDK Dec 16 '13 at 15:30
Can you please provide the URL of our site? Also, I would recommend you to set the scope of each Custom Variable call (although it's an optional parameter). – user43821 Sep 11 '14 at 6:22

I'm honestly not sure why your implementation isn't working properly, but just wonder if its more to do with Google Analytics having changed how they work to now use what they call Universal Analytics, where instead of calling ga.js scripts now call analytics.js and Dimensions and Metrics have to be pre-configured in Google Analytics and assigned a numerical index each, e.g. dimension0, dimension1, dimension2 (not renamable) for text values, or metric0, metric1, metric2 etc for numerical values.

Read Google Developers: Google Analytics - Custom Dimensions and Metrics for more information.

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Custom variable test</title>
  <script type="text/javascript">
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  <h1>Hello on my custom variable test!</h1>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.