Jump to content

Google analytic tracking code


lynnmcdee

Recommended Posts

Hi,

 

My Google analytic code is out of date and I need to update the code.

 

I have tried to add the code to the main.php file.  Google advised to paste it immediately before the closing </head> tag.

 

I have tried this but it is not working.  What am I doing wrong??

Link to comment
Share on other sites

The code you were given by Google may not be formatted according to the template engine's requirements.

 

We recommend that you get latest CC5 package (if your store is CC5), and using the Google code from that in your existing files.

 

Otherwise, put:

{literal} and {/literal}

around the code Google gave you.

Link to comment
Share on other sites

Hi,

 

Yes, I am using CC5.  The code already has {literal} and {/literal}

 

{literal}
<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','//www.google-analytics.com/analytics.js','ga');
 
  ga('create', 'UA-********', 'auto');
  ga('send', 'pageview');
 
</script>
 
{/literal}
Link to comment
Share on other sites

That is the same code present in CC5216 located just above the </head> tag. One slight difference:

You have:
ga('create', 'UA-********', 'auto');
 
CubeCart has:
ga('create', '{/literal}{$ANALYTICS}{literal}', 'auto');

By having {$ANALYTICS}, the store admin can enter the account number in the admin settings.

 

The above code tracks your visitor's movements, not sales conversions. The sales conversions code is in the content.receipt.php file.

Link to comment
Share on other sites

"I can't get the tracking code to work."

 

Please let us know how you come to the conclusion that the tracking code is not working.

 

Google Analytics is javascript, so the responsibility - assuming the javascript code is correct - is with the browser, with it being affected by any browser add-ons, your personal computer's firewall, etc.

 

Does your browser have a diagnostic mode where you are shown all the page requests and responses (a 'Network' page)? If so, look for your browser to make a request to www.google-analytics.com for the real analytics code, followed by other calls to google.

Link to comment
Share on other sites

"I can't get the tracking code to work."

 

Please let us know how you come to the conclusion that the tracking code is not working.

 

Google Analytics is javascript, so the responsibility - assuming the javascript code is correct - is with the browser, with it being affected by any browser add-ons, your personal computer's firewall, etc.

 

Does your browser have a diagnostic mode where you are shown all the page requests and responses (a 'Network' page)? If so, look for your browser to make a request to www.google-analytics.com for the real analytics code, followed by other calls to google.

When I log into Google Analytic there is a warning message - 'Missing Tracking Code'

Here is a fix for versions of CC5 between 5.2.11 and 5.2.14:

https://github.com/cubecart/v5.2.14/commit/766c38d04f91d39c7b9e9a4b8391f66d4ac58714

 

I am currently using version 5.2.5

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...