2

Everytime I add the tacking code to the source code on the websiet, EE strip it out. Is there anyway to get it to stay without using a plugin?

1
  • I should also mention that I am not seeing a way to access the HTML where I am supposed to place the codes in the header and body. I noticed you mentioned you add to the footer? That is not the instructions Tag Manger is giving me.
    – Sara
    Commented Jan 23, 2017 at 17:31

2 Answers 2

4

Just to echo Johnathan's answer, I put my Google Analytics tracking code in a Global Variable (usually called footer) which is added to each template.

2

Put it in the template as opposed to in a field type. If you need to be able to change the number, just make that a field instead. Just put this in the template and replace {yourfieldhere}

 <script>
  var _gaq=[['_setAccount','{yourfieldhere}'],['_trackPageview']];
  setTimeout("_gaq.push(['_trackEvent', '15_seconds', 'read'])",15000);
  (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
  g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
  s.parentNode.insertBefore(g,s)}(document,'script'));
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.