Jump to content

Adding Google Analytics tracking I.D


Steve Silver

Recommended Posts

Posted

Tried adding a Google Analytics tracking I.D into the 'Analytics' CP,  code looks something like, e'g;  UA-95867698466
but once I add this - it then appears as text literally at the top of the index page header!
Anyone know if this is an error? or there's a different way to add the Analytics code?

Posted

You'll want to use the whole tracking script that Google provides. The "UA-..." ID is just your account ID.

The tracking script is Javascript so will start with a "<script..." and end with "</script>" (of course without quotes).

Posted
4 minutes ago, Steve Silver said:

Tried adding a Google Analytics tracking I.D into the 'Analytics' CP,  code looks something like, e'g;  UA-95867698466
but once I add this - it then appears as text literally at the top of the index page header!
Anyone know if this is an error? or there's a different way to add the Analytics code?

You'll need to use the full analytics js code

Posted
7 minutes ago, Steve Silver said:

Tried adding a Google Analytics tracking I.D into the 'Analytics' CP,  code looks something like, e'g;  UA-95867698466
but once I add this - it then appears as text literally at the top of the index page header!
Anyone know if this is an error? or there's a different way to add the Analytics code?

Add this script

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-95867698466', 'auto');
ga('send', 'pageview');
</script>

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...