Google Analytics code isn't working?


(Jack James) #1

In the ga_tracking_code I’ve pasted the code but it isn’t working. Is there something specific I’m not supposed to include?

I’ve done it like so:

<script type="text/javascript">    var _gaq = _gaq || [];   _gaq.push(['_setAccount', 'id###']);   _gaq.push(['_trackPageview']);    (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);   })();  </script>

(Kevin Ansfield) #2

You only need to enter your account code id###


(Daniel Watkins) #3

To be clear, that’s the UA-1234567-1 code.

See also:
http://meta.discourse.org/t/google-analytics-tracking-doesn-t-work-on-most-urls/3500


(Jeff Atwood) #4

Good point, I updated the help for that admin field (and many of the other fields) to improve them.

Now it provides an example:

ga_tracking_code: "Google analytics tracking code code, eg: UA-12345678-9; see http://google.com/analytics"


(Jack James) #5

Thanks, it wasn’t clear from the field description, glad to know it’s to be updated.


(Nick Harrington) #6

Hi folks,
I’m a discourse noob so apologies for what might be a simple question.

/admin settings for Google Analytics requests the following fields:

ga_tracking_code UA-12345678-12
ga_domain_name community.ambay.com
ga_universal_tracking_code UA-12345678-12

Is ga_tracking_code identical to ga_universal_tracking_code, as I only get one id from the Google tracking code. After 48 hours I’m still getting no analytics, so question whether I have this setup correctly. Does this look correct to those who have this working?

Nick


(Jeff Atwood) #7

Do not enter universal, that is a different thing .


(Michael Downey) #8

Is there a benefit to entering the tracking code in the admin tool rather than adding it to the header or footer in full form? Allowing users to enter the full code allows some customization about what data are collected.

I wasn’t sure if there was some voodoo being done when entering the universal analytics (the “classic” one is now deprecated by Google) code in the admin form.


(Hutch) #9

I am having a similar issue to above. GA is tracking / but not topics.

Topic source:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-55210025-1']);

    _gaq.push(['_setDomainName', 'auto']);

  _gaq.push(['_setCustomVar', 1, 'Anonymous', false, 2]);

  (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);
  })();

</script>

Any ideas?