0

I apply a Google analytics service. I got a code.

<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', 'MY UA CODE', 'auto');
  ga('send', 'pageview');
</script>

My drupal use AT Commerce this theme. Where do I put this code to my folder's file? There is an optional method. The php is here where I want to add to my block and let it call the above script.

<?php include_once("analyticstracking.php") ?>

Do I follow the same name analyticstracking.php or just add the above script to an existed php file? Thanks.

1

You can install module Google Analytics. Or paste script to file html.tpl.php.

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.