Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChristopher Stephenson
3,047 PointsGoogle Analytics Status: Tracking Not Installed
I'm trying to use Google Analytics on a Wordpress blog. I've copied the tracking code and placed it in the header.php file just above the </head> tag. I've done this in the past and been successful but the status on Google Analytics will not change to "receiving data." Can anyone tell me how to fix this or what I might be doing wrong?
If you go to the website, you can see that the code is definitively there. http://www.RealEstateMarketingLabs.com
2 Answers
matthewhorton68
13,882 PointsI have good experience with the Yoast Analytics plugin(the one on the right. The free version) https://yoast.com/wordpress/plugins/google-analytics/
That plugin will insert all the tracking code for you.
Rose Cass
16,323 PointsJust looking at the site, it seems that the google analytics is not even present, meaning it not even rendered on the page. You can see this yourself, by inspecting or viewing the page source and searching "google" that there isn't any google analytics code to be found.
Since the code is not present at all I would double check where you put the code. May want to check that your analytics code code after the body tag in header.php.
There are also many other ways of adding analytics to your WordPress site, so you may want to take a look at this article: http://www.wpbeginner.com/beginners-guide/how-to-install-google-analytics-in-wordpress/
Hope that helps,
Rose
Christopher Stephenson
3,047 PointsAre you sure? I just looked at the page source and found this just above the closing header tag.. <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-59455895-1', 'auto'); ga('send', 'pageview');
</script>
Rose Cass
16,323 PointsOh sorry. Ya you are totally right, I didn't see that before.
Anyhow, when I use Tag Assistant by google, it recognizes the GA code. Screenshot: https://www.evernote.com/shard/s54/sh/6c1dc4f9-e202-417c-931b-31229b64ef0b/07f85f19482958b78e9f387cacf935ad Link to Tag Assistant: https://chrome.google.com/webstore/detail/tag-assistant-by-google/kejbdjndbnbjgmefkgdddjlbokphdefk?hl=en
As far as I can tell, it looks like it should be working.
In the GA dashboard I usually check via the real time reporting and open the site in a incognito window do see if it see it.
Rose Cass
16,323 PointsRose Cass
16,323 PointsLove that plugin. I have used it on many client sites, since clients like having Google Analytics viewable from the WordPress dashboard.