3

I hope you can assist me with this! I've recently changed the preferred domain for my site https://example.com. Unfortunately, after doing so, it appears that views/visits are no longer being recorded by Google Analytics. I've edited the URL in GA's Admin settings to indicate that it is now https://example.com - perhaps it just needs some time to settle in?

Also, I'm not quite sure if I've set up the 301 redirect correctly after setting my preferred domain.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

If I have an HTTPS site, do I need to add the 's' to the sections that contain 'HTTP'?

  • Is that your actual htaccess? – John Conde Jan 13 '18 at 16:46
  • Hi John - no, it was just a template that I used. I replaced 'yourdomain' with my site's information! – Ann Jan 13 '18 at 17:05
  • 1
    Do you have filter set in Google Analytics? One of the solutions for GA spam is to set a filter so only hits to your domain count in the GA stats. If you have ever implemented such a filter you need to change it now that you are not using the www. – Stephen Ostermiller Mar 16 '18 at 11:53
0

That should not happen. When you use a redirect like that it doesn't trigger any JavaScript, not any site load. Hence your analytics shouldn't recognize any action and stop recording stats.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.