The Google Analytics tracking code is now the same for both secure and non-secure websites. The new tracking code detects the protocol of the page being tracked and matches the security of your web page automatically. Pages with URLs beginning with http:// will download the non-secureversion at and pages with URLs beginning with https:// will load the secure version at No modification of the trackingcode on secure pages is required.

Although the previous version of the tracking code (urchin.js) required you to copy/paste specialtracking code into your secure pages, this is no longer necessary if you are tracking your site with ga.js. You can use the same tracking code on both secure (https://) and non-secure (http://)pages.

The new tracking code looks like this:

var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(“%3Cscript src=’” + gaJsHost + “’ type=’text/javascript’%3E%3C/script%3E”));

try {
var pageTracker = _gat._getTracker(“UA-xxxxxx-x”);
} catch(err) {}

Post By Gishore J Kallarackal (2,121 Posts)

Gishore J Kallarackal is the founder of techgurulive. The purpose of this site is to share information about free resources that techies can use for reference. You can follow me on the social web, subscribe to the RSS Feed or sign up for the email newsletter for your daily dose of tech tips & tutorials. You can content me via @twitter or e-mail.

Website: → Techgurulive