Google Analytics Redirect rules

How to setup Google Analytics and Google Search Console/Webmaster Tools

When you move your site to ssl, you have to adjust your settings in Google Analytics and Google Webmaster Tools/Search Console accordingly. It’s not much work, but it’s important you fix it. In short, you need to set your primary domain in both Webmaster Tools as in Google analytics to your https domain. I’ll discuss Search Console first, but it really doesn’t matter in which order you do it.

Webmaster Tools / Search Console

In Google Search Console (Google Webmaster Tools), you should add the https variant, and you should set it to your preferred domain as well. You should add all variants of your domain:

  • http://domain.com
  • http://www.domain.com
  • https://domain.com
  • https://www.domain.com

   

If you don’t know how to add a new property, follow these instructions from Google.

Set one of the https domains as your preferred domain. This should match the one in the general settings of WordPress, the site url. To set as your preferred domain, do the following:

  1. On the Search Console Home page, click the site you want.
  2. Click the gear icon, and then click Site Settings.
  3. In the Preferred domain section, select the option you want.

Google Analytics

After you move to SSL, you should change your domain in Google Analytics to https. This way, GA starts registering your hits again. If the redirect wasn’t set in your .htaccess for some reason, try to add it manually. GA might not register hits when the .htaccess redirect was not in place.

To do this, in Google Analytics, go to manage / property settings, and change the protocol to https.

To make finding this setting a bit easier, I’ve added some screenshots to illustrate the needed steps. The language on the screenshots is not English, but it will look the same in English.

step-1-start step-2

Go to “Manage”

step-3

Select “settings”

step-4

Now, change the protocol to https.

step-6

Related Articles

20 Comments

  • Noumaan

    I think users don’t need to add preferred URL in Google Search Console (webmaster tools) any more. Also I can’t find the option to select https variant. Indexing HTTPS pages by default

    • Rogier Lankhorst

      Reading that article, I’d agree that Google does it’s ranking of http and https automatically, but in Google Search Console, you are encouraged to 1) add all versions of your site, and 2) set a preferred domain. See also this article of Google https://support.google.com/webmasters/answer/34592?hl=en. To select the https variant, add it first as site, then set it as preferred domain.

      • Kathy Fisher

        If I previously added my site to Google Search console as http, so I have to make an entirely new entry in Google Search console to add it as https?

        Thank you!

        • Rogier Lankhorst

          Yes, you add it as a separate property. It seems a bit strange, but that’s how Google like’s it 🙂

  • Erin Pavlicek

    Thank you so much, Rogier! This was a fantastic article, super easy, and very helpful! So grateful to you for all your work and services!

  • Barbara DiLucchio

    Hi Rogier,
    Does it matter whether I change the domain to https in Google Analytics first or Search Console first? Looking at the screen shots it looks like search console was done first but I want to be sure.

    Thanks very much,
    Barbara

    • Rogier Lankhorst

      No, the order doesn’t matter.

  • Felix

    I was change to https by let’s encrypt, but when I browse to my website, it does not appear blue locks. Pls help me. Tks.

  • Katia

    Rogier,

    Even though I didn’t change this yet in Google Analytics, it does still count views on my website. One question I do have is, if I change http to https in GA, will I loose the historical analytics of the http address?

    Thanks for your help.
    Katia

    • Rogier Lankhorst

      Hi Katia,

      On the sites I did the migration for, the historical data is kept after the change to https. Even if your hits are still registered, it’s better to let Google know what your primary url is.

  • Leana

    Hello,
    At the Google Search Console, I only got to enter the first variant of my site’s name and now I don’t understand how to verify it or how t enter the other versions. Such as http://www..etc or https:… I’m not understanding the Google Analytics portion of how to proceed with the real simple SSL plug in? Please help?

    Thank you

    • Rogier Lankhorst

      You can just add a new property in Google Search Console. I’ve added a link to Google instructions how to do this to the article. As for Google Analytics, if you follow the steps described in the article, you should be fine. Is there anything in these steps that is not clear?

  • Saul C.

    Thanks for the article! One question: Do we have to add a new property in Google Analytics with https instead? Or is making the switch from http to https as you described here all we need to do? I followed the article, and in analytics it still shows at the top http://mydomain.com instead of https. Is this normal? I have it set to https as you showed here but just want to clarify that this is all I need to do, or if I should add another property in analytics. Your clarification will be appreciated!!

    -Saul

    • Rogier Lankhorst

      It sounds like you’ve done it right. Is it possible the name of your property is “http://domain.com”? the name doesn’t have to contain the protocol, it’s just a descriptive name.

  • Hanif Adnan

    Hello, i already add all 4 variant URL to Webmaster and those are verified. But…i don’t know how to set one of the https domains as “preferred domain”. Can you help please ?

    • Rogier Lankhorst

      I’ve updated the article with instructions how to set a domain as preferred domain.

  • Martine Loeffen

    Hi there!

    Thanks for a great plugin!
    One question tho: after reactivating the plugin in WP 4.7.1, the “SSL activated! Don’t forget to change your settings in Google Analytics en Webmaster tools. More info.” message in my admin section has lost it’s x to close it.
    I’m very happy it’s all working, but I’d like to get rid of the message 😉 Saving the settings didn’t help.

    Any tips welcome, tia!

    Martine

    • Rogier Lankhorst

      Hi,

      I have tested it with the latest beta release from WordPress, and it works without problems. In some cases the x is hidden behind the “help” dropdown.

Leave a Comment