Announcement

Collapse
No announcement yet.

Google Analytics Settings - Website URL - http or https?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Google Analytics Settings - Website URL - http or https?

    Reading thru some older threads a couple weeks ago, I saw that some recommended setting your Website URL to the secure version of your domain: https. This is how I have it set. But I'm wondering if this advice is still valid. I think I read something suggesting that with the newer code, GA can now figure out secure vs non-secure on its own. So maybe it's okay now to use the non-secure version of your domain: http?

    I ask this because I'm trying to get my Site Overlay feature to work. I'm grasping at straws here trying everything I can.

    Thanks!
    Kyle Creasy, Alphatect

    #2
    Re: Google Analytics Settings - Website URL - http or https?

    The new Asynchronous Tracking Code uses the following line of code to determine http or https status:

    Code:
    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    </script>
    The older ga.js Tracking Code uses a similar method, while the discontinued Urchin Tracker Code required a conditional, or many just set things to https permanently.

    Comment


      #3
      Re: Google Analytics Settings - Website URL - http or https?

      Thanks Dan. So is it now preferable to use the non-secure http?

      Comment


        #4
        Re: Google Analytics Settings - Website URL - http or https?

        No, you want the tracking code to determine if the user is on a secure page or not and switch back and forth accordingly, which is what the line of code displayed above does.

        What version of the Google Analytics tracking code are you using? (ie. Urchin, ga.js or Async.)

        Comment


          #5
          Re: Google Analytics Settings - Website URL - http or https?

          Well I'm using the Asynchronous code. So that has an http-https switching mechanism. But what about my settings:

          Profile Settings > Main Website Profile Information > Website URL:

          You have to choose either the http or https version of your domain - unless you go straight www... I've been using https. Are you saying just delete this altogether and leave the "Website URL" field blank?

          Comment


            #6
            Re: Google Analytics Settings - Website URL - http or https?

            Kyle,

            I am sorry, your referring to the actual account settings within Google Analytics... my apologies.

            There is really no reason to set that specific setting to https:// as it just tells Google Analytics what the root domain is for reporting. (it really has no affect on tracking in any way) You can change that to http://www.yourdomain.com/

            Again, sorry for misunderstanding your question on this.

            Comment


              #7
              Re: Google Analytics Settings - Website URL - http or https?

              Thanks Dan! I'll try that.

              Comment


                #8
                Re: Google Analytics Settings - Website URL - http or https?

                I should note that you need to watch the trailing slash on your specified domain. If your store is using http://www.yourdomain.com as the storefront url for example, and you have http://www.yourdomain.com/ specified in Google Analytics, this can throw off Site Overlay. If your site is using http://www.yourdomain.com/, then you would change that setting accordingly in Analytics.

                Comment

                Working...
                X