How does Google Analytics work?

So, I was just wondering about Google Analytics, specifically the free version. How powerful is it? Can I put it in my web serial without having to upgrade?


I find Analytics one of the most accurate traffic reporting things I've used. For a long time I used GA along with two server-based systems (webalizer and... I can't remember the name of the third) and I've since settled on GA only.


Basically you insert a specific piece of code in all the pages you want tracked. It contains a unique identifier that GA creates for your site, and once it's in there GA uses that to track what's going on in your site. It's at the point where you can actually get demographic information (sex and age of people browsing your site) which is just nuts and, quite frankly, a bit frightening.


Ok. So where on a Wordpress site would I put this piece of code?


It's been a looooong time since I've used Wordpress but if I remember correctly there is a tab that gives you access to the code used in whatever template you're using. You'll need to insert it in the header (I think) of your active template. There will be some instructions in the GA site about the specific code and where it needs to go when you set up your account, then you just take the code they generate and put it in the right template.


Well, it's a piece of javascript, and I generally put javascript (especially from outside sources) at the bottom of the page--just before the last html tag in the bottom part of the template.


That said, you don't have to work with the code at all. All you have to do is download a plugin and then put the Google Analytics ID you got into whatever field in the plugin's settings asks for it. That assumes you're using the self-hosted Wordpress. If you're using Wordpress.com, you probably have to do the same thing (though a Google Analytics plugin may be part of the standard installation there). If Wordpress.com doesn't have a plugin for it, it's possible that you can't because Wordpress.com is distinctly hostile to javascript they didn't create themselves. Also, they don't give you access to the templates' html--just the CSS.


All the same, my experience is that while Wordpress.com's statistics aren't anywhere near as good in terms of what you can learn as Google Analytics, they're approximately the same in terms of numbers. I have access to both on my self-hosted Wordpress instalation and occasionally compare them.


Ok, I set up the analytics account and entered my website's URL into it. However, Analytics doesn't seem to be collecting data from it. What should I do?


There's more to it than that. The GA page will have a piece of javascript code you need to insert into your web pages. The GA page should have instructions on how to do that.


Did some research. Apparently, the only way I can get analytics on my site is spend $299 a year for one of the advanced plans.


Ouch. So there's no way to get to your site page source code?


None that I can see. Where do you usually find it?


I'm afraid you're out of luck, T4nky. There are several very basic web-dev things that wordpress.com locks behind paywalls, a practice I find quite predatory. Control of your CSS (used for detailed styling and customization), your javascript (used for scripts and plugins, including Google Analytics), and even things like site-forwarding and backup (I own twistedcogs.com, but refuse out of principle to pay wordpress to redirect it, not when I could do it myself in 20 minutes if I had access) are all things that fall into that category.


As a professional web develpoer this is particularly infuriating, but the solution of installing and self-hosting a wordpress distribution is probably prohibitively complex for someone without the technical know-how, and when I attempted it a few years back I had a bit of trouble hooking it into the social aspects of wordpress.com like subscriptions / comments / follows. If it's something you were gung-ho about trying, though, let me know and I can try to find time to whip up some pointers on how to go about doing that.


I self-host Wordpress, though I haven't used Google Analytics before (I've looked at it but never got around to using it - maybe I should now!).


I just did a quick check, and there's a whole host of (free) plug-ins to embed GA into your site, most of them including a dashboard (within Wordpress) so you have one place to check all your site's stuff.


Setting up a self-hosted Wordpress installation is pretty simple these days, depending on your host. A lot of them have tools that basically do it all for you - you tell it the name and location you want, and it handles installing WP, setting up and linking the database, and links you to where you need to log in to configure it. From there, you're using the WP back end to do everything, which is pretty easy for less technical users.


My current host has a system called Softaculous, and my previous host had one called Fav-something (I forget the full name). These did full WP installs for you (as well as various other applications like PHP, drupal, etc). Web hosts usually include this type of feature in their list of what you get for your money, if they have it.


Hope that helps! Good luck!


I stand corrected! I'm actually really glad to hear that it's become easier...I might have to take another look at self-hosting for my next serial. Thanks, Kess!


You're welcome! I've done the WP install the long, hard way, and was so happy to find a tool that would do all the legwork for me. Only too happy to share. Enjoy!


(Just make sure your host offers it!) :)