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?

  • 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 Jan 23 '17 at 17:31
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.

| improve this answer | |
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>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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