Where should I add the Google tracking code for Google Analytics?
Question: -
Q: Can I add the Google Analytics javascript code to my "footer" file, which is an include file, so
that it is added to all my web pages at one time?
Answer: -
Best practices for all Javascript are to place at the bottom of the page, if possible. And yes if you are using a CMS system or have another mechanism for globally placing the file via a 'footer file,' then you can definitely do it that way.
One important point: the JS codes must be on all pages of your website to be tracked. Google Analytics will give you some feedback about the code in terms of if it is gathering data, but if you start your website with 100 pages, and correctly place the code, and then some months later add some 50 pages and do not add the code, it will not alert you to that fact. So you must manually or systematically check to be sure that you have put the code on all pages of your site, if you want data from all pages!
Hope this helps!
- Jason
|