Enable SSL for Google Analytics

Unsecure Google Analytics Warning

If you use the unsecure Google Analytics code on one of your secure web pages your web browser will warn that there is some page content that is not secure. This problem can be easily solved by slightly changing the code used to load Google Analytics.

Instead of:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>

Use:

<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"> 
</script>

If you still get the "page contains secure and nonsecure items" after changing that code you should check for other page elements that are using http instead of https.

Google's information about using SSL with Google Analytics is also available.

Update: Google has now updated the Google Analytics code to use ga.js instead of the urchin.js file. In the process, they have implemented code that will automatically detect whether http or https needs to be used. The new code will also enable new features so it is recommended that you upgrade. This will solve the SSL problem so you won't need to worry about the solution above. The upgrade instructions can be found here.

Originally posted on Mon Oct 8, 2007

Comments (1)

  1. computer security:
    Nov 14, 2007 at 06:46 AM

    Once the analytics code is on your pages, you can check to make sure tracking is working by going to the Google Analytics Management Screen and looking at the Status of your site profile. If the status is unknown, there will be a link to Check Status. When you click on that link, Google Analytics will test your site to see if the code is present and working. If your status is Waiting for Data, your code is working properly and Google Analytics is gathering information. When your status becomes Recieving Data, Google Analytics has gathered information long enough to start creating reports. Added by www.securiour.com





Allowed tags: <b><i><br>Add a new comment: