Installing Google Analytics on a Linux hosted Website March 24, 2011Posted by Tournas Dimitrios in Uncategorized.
Google Analytics is the enterprise-class web analytics solution that gives you rich insights into your website traffic and marketing effectiveness. Powerful, flexible and easy-to-use features now let you see and analyse your traffic data in an entirely new way. With Google Analytics, you’re more prepared to write better-targeted ads, strengthen your marketing initiatives and create higher converting websites.
If your website pages are created dynamically with a technology such as PHP or ASP, you can include the tracking code in a separate file that gets included as part of the overall page template. To see a sample implementation on a PHP page, visit the Analytics Help article . Have you ever needed to install Google Analytics on all static HTML files on your website ? If you have a large website that can be a lot of work so you have a few options.
- You can have the apache webserver install it automatically on the fly http://ballade.cs.ucla.edu/~kirill/analytics.html The downside here is that this requires CPU power and can slow things down a bit if you are not using modperl
- Search and replace all instances of the body tag with your analytics tag. You could use perl or sed on the unix command line to do this. Some ideas here
- Or just use this script from http://gleamynode.net/articles/2230/
Usage Tips :
- this will search and insert Google Analytics code for ALL .html files so if you are in the master directory with multiple websites below be careful.
- Set your filetype to unix if you are uploading this script otherwise you will get errors
- Be sure to put in your own analytics ID