Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2007
    Posts
    23

    Google Analytics code is unsecure - how to secure?

    Okay - I have added the following code to main_index.html to get the Google Analytics working, and it's been working great :

    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "XX-XXXXXXX-X";
    urchinTracker();
    </script>

    It's located directly above the closing </body> tag in main_index.html.

    It's causing the secure portions of my site to display "This page contains both secure and unsecure..." message, and it's annoying. Is there a way to secure this?

    I've verified that the rest of the site is good - I only get this message when the Google Analytics code is on the main_index.html page.

    Thanks!

  2. #2
    Join Date
    Sep 2007
    Posts
    22
    (I think) all you need to do is change the http to https
    Cheers,
    Phil

  3. #3
    Join Date
    Jun 2007
    Posts
    23
    Quote Originally Posted by PhilC View Post
    (I think) all you need to do is change the http to https
    Cheers,
    Phil
    Looks like you're right for the most part - from http://www.google.com/support/google...n&answer=55483

    How can I obtain tracking code for secure pages?


    If your site includes secure web pages using the HTTPS protocol, you'll need to make sure that your tracking code is tailored for secure access. If your Website URL includes https, your tracking code will already be customized for secure pages. Otherwise, you'll need to update this value for your profile.

    To obtain Google Analytics tracking code that is tailored to secure (HTTPS) web pages:

    Log in to Google Analytics
    Find the profile for which you are obtaining tracking code and click Edit
    In the Main Website Profile Information bar, click Edit
    Edit the Website URL field by specifying https:// rather than http://
    Click Save Changes
    To obtain the secure tracking code, click the Check Status link above the Main Website Profile Information bar. Your tracking code will be customized for secure pages and will look like the example below:

    <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-XXXXX-X";
    urchinTracker();
    </script>

    You can add this secure code to both secure and non-secure pages of your site.
    Last edited by naps; 11-13-2007 at 01:26 PM. Reason: Clarifications

  4. #4
    Join Date
    Nov 2007
    Posts
    190

    Where to Insert Goolge Tracking Code?

    Don't you need to put this code like in the footer of every page? Or does adding it to the index page accomplish that?

  5. #5
    Join Date
    Nov 2007
    Posts
    190

    Good News for Google Analytics

    They have a new code you can implement that it doesnt matter if it is a secure page or unsecure page. Here is the text from Google. Just update your page with the new tracking code.

    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-secure version at http://www.google-analytics.com/ga.js and pages with URLs beginning with https:// will load the secure version at https://ssl.google-analytics.com/ga.js. No modification of the tracking code on secure pages is required.

    Although the previous version of the tracking code (urchin.js) required you to copy/paste special tracking 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:

    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>

    <script type="text/javascript">
    var pageTracker = _gat._getTracker("UA-xxxxxx-x");
    pageTracker._initData();
    pageTracker._trackPageview();
    </script>

  6. #6
    Join Date
    Aug 2006
    Location
    San Diego, CA
    Posts
    4,340
    Not necessarily. you can add it to a template that gets used on every page like main_index.html.

  7. #7
    Join Date
    Jan 2017
    Posts
    1
    Quote Originally Posted by PhilC View Post
    (I think) all you need this to do is change the http to https
    Cheers,
    Phil
    Lol, thanks! That's all it took to stop my site showing up as insecure.
    Last edited by Thorbes; 08-21-2017 at 05:53 AM.

  8. #8
    Join Date
    Jan 2018
    Location
    Agoura Hills, Los Angeles
    Posts
    1
    You can setup your Google Analytics account using Google tag manager. Tag manager will make your ID secure.

Similar Threads

  1. Google Analytics not tracking, Is the Source Code Wrong
    By jalper in forum Troubleshooting and Problems
    Replies: 1
    Last Post: 01-14-2012, 02:09 PM
  2. Replies: 2
    Last Post: 02-24-2011, 11:52 PM
  3. Google Analytics Code Placement
    By jfeitlinger in forum Suggestions & Feedback
    Replies: 0
    Last Post: 09-26-2008, 08:37 PM
  4. Google Analytics e-commerce Code
    By flyingwil in forum Customizations, Mods & Plugins
    Replies: 4
    Last Post: 04-28-2008, 10:41 AM
  5. Google Analytics
    By chasquad in forum Troubleshooting and Problems
    Replies: 6
    Last Post: 09-11-2007, 05:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •