Latest News: (loading..)

Archived

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

scarletttam

Where to paste the Google Analytics Code?

7 posts in this topic

Hi,

 

I was trying to find the right spot to put my google analytics code. It says put the code onto every page that I want to track immediately before </head> tag . I want to track my product pages.

 

<script type="text/javascript">

 

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-xxxxxxx-x']);

_gaq.push(['_trackPageview']);

 

(function() {

var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

})();

 

</script>

Share this post


Link to post
Share on other sites

I put mine in includes>footer.php, so it covers all pages.

Share this post


Link to post
Share on other sites

In version 2.3.1, you don't need to change any file, there is a module for that available, under admin>modules>header tags

 

Install the googe analytics module and then just type your google number into there

Share this post


Link to post
Share on other sites