Hey friend! Have fun exploring Q&A, but in order to ask your own
questions, comment, or give thumbs up, you need to be logged in to your
Moz Pro account.
You can also earn access by receiving 500
MozPoints
from participating in YouMoz and the Moz Blog!

Wordpress + Google Analytics = Pulling My Hair Out

I have analytics set-up for a personal site I run and I know, verifiably it's receiving traffic, however, whenever I access my Google Analytics dashboard, it says I've had zero visits.

Interestingly, today I had a colleague check the site from a foreign country and I could see the page views (within 15 minutes), however, I could not get any information about the site viewer.

I have verified that the Analytics profile is 'receiving data' (which it is) and my Google Webmaster Tools is not reporting any issues?

Finally, I went ahead and updated my profile so that it is pulling from 'www.mydomain.com' instead of 'mydomain.com', I don't know if that'll make any difference, but likewise, I didn't want to go and create the 'little kid in the elevator' analogy, where I'm just pressing a bunch of buttons just because they're there.

So the only changes I've made thus far were deactivating Yoast's SEO plug-in and manually placing the GA code in the header and updating the 'Website's URL' in the profile settings tab of GA from 'mydomain.com' to 'www.mydomain.com'.

With that, I am stumped and praying another one of the esteemed Mozzers out there may be able to help me resolve this. Any thoughts?

Make sure you are using the asynchronous analytics code. Once you've added it to the site, view the source and make sure it appears exactly as you input it. Make sure you select today's date in the analytics range (default is yesterday).

Another thought - if you had set the domain's URL as website.com, but in fact nearly all traffic was going to www.website.com and you didn't have a 301 redirect in place to point the non-www version to the www version, that could cause the data issue as well, I think.

The non-www version was not 301 redirected, however, when I updated the 'default URL' in the property settings from 'mydomain.com' to 'www.mydomain.com' I started seeing traffic stats again for that profile.

I previously re-wrote the .htaccess file to redirect accordingly, however, was having problems finding pages on my site after I implemented the changes.

Even though I can see the traffic stats now, do you think I should still try and implement the redirect? Likewise, would implementing the 301 create navigation problems (i.e. 404s, pages not being found) if I don't implement some sort of dynamic URL re-writes to update all the site pages URLs?

You'll definitely want to have the non-www version 301 redirecting to the www version, otherwise you're inviting ranking issues with the search engines.

Done correctly, you shouldn't encounter any 404s as a result, and there's nothing needed to do as far as "re-writes to update all the site pages URLs". That's precisely what the 301 redirect is designed to handle.

That said, if you have created links on your own website that point to the non-www version (in navigation or in post content for example) it would be a good idea to change them to what's called the Fully Qualified Domain Name or FQN. 301 redirects are suspected not to pass absolutely all their link juice through, so it's best to link directly to what you've decided will be the FQN for your site - i.e. the www.yoursite.com version.

Hey friend! Have fun exploring Q&A, but in order to ask your own
questions, comment, or give thumbs up, you need to be logged in to your
Moz Pro account.
You can also earn access by receiving 500
MozPoints
from participating in YouMoz and the Moz Blog!
Learn more.