Google Analytics Plugin for WordPress

This is the first beta release of a WordPress plugin that can add Google Analytics to your website without you needing to code one single set of <>’s.
I have it running on this site and it seems to be working just fine so far.
Installation instructions
To use it:
- If you have a previous version of the plugin, delete it.
Download this file- Rename the file
googleanalytics.phpand copy it to your/wp-content/pluginsdirectory. - Enable it on the plugins page.
- Enter your Google Analytics User Account string (it’ll be something like UA-12345-6. It appears when you “Add a channel”)
- That’s it.
You don’t need to look alter the code in any way to make it run; of course you’re welcome to improve it and send me any updates for inclusion.
Features
- Zero Coding
A zero coding install enables both the default tracking and the use of different channels for specific posts. - Outgoing links
Track which outgoing links your users click on – i.e. the ones that don’t traditionally register in your logs. Separate tracking streams for outbound links that are in the main article, comments, and comment author URL’s
- Multiple Channels
Assign a specific channel to any article by entering the channel ID as metadata. i.e. simply type “analytics” as the metadata field name and the channel ID as the value and you can run a channel for each specific post
Requested Features
- Filtering the Sidebar
WordPress provides hooks for filtering articles and comments, but not for filtering the sidebar and footer. Since the sidebar often includes the blogroll there are page-exit clicks that cannot be tracked. If anyoen has a clean solution to filtering the sidebar then please speak up! - 100% Point’n'Click UI
I’ve asked on the forums to see if there’s away to automate the retrieval of the account id, so hopefully the plugin can become a configuration free install.
Assign a different channel ID to each category.
Versions
A historical list of releases.
Contribute
Please neatly tuck any feedback, comments, suggestions & requests onto the forum!
329 Comments
Hi Olly,
thanks for the pointer.
I’ve released 0.51v, which hopefully fixes that snafu.
Rich
The plugin sounds great. I installed it and put in the acct # in the plugin manager and all seemed to go well except Google says the tracking is not installed.
I went to view source and it says:
<!– Google Analytics Plugin for WordPress –>
<!– The plugin is enabled but no channel account number is available. –>
Any thoughts?
Thx
Russ
Hi Russ, that message shows up if you’ve installed the plugin but not entered your account number as described in the installation steps above.
I see that your site is currently showing the correct script (with the account number in the right place, so you already sussed that bit).
My assumption is that the Analytics server is just a bit behind. It’s often several hours before they show data, so let me know in a day or two if it hasn’t started recording data for you.
Hmmm… i’ve done it all… but the code does not appear in my pages… i’m confused. I searched by “urchin” and it’s not there.
I have my blog set up at word press. Is there another way to install Analytics if they do not have a plug in section? I really want to utilize this program but don’t know where to put it without a plug in page.
Any help would be great! If not, do you know of other sites that work with program that are similar to word press as far as format, tools, easier pictures, and clean format?
Thank you!
Tenderfoot
One problem I can forsee is that WordPress.com already use Google Analytics, so your blog is analysed as part of their whole general blog mish-mash.
Your best bet is to ask the Automattic folks who run WordPress,com if they can help.
This rocks! This is great and works perfect. Thank you very much for this brilliant and handy plugin.
The plugin is ridiculously simple to install – thanks for developing it!
Hi. I have installed your plugin in my WP blog. It seems ok so far. My question is, how does this thing really work? I mean, should i be going inside my google analytics account and view the reports there? or are there ways to view the reports inside my blog admin?
Thanks.
Could someone invite me to Google Analytics?
tubbe(at)tubbe(dot)dk
I’d really appreciate it!
Hi Tubbe, this and this might help.
Hi Ruel, as you suggest, just login to analytics.google.com to view the reports. There are other plugins that enable you to view your reports within the WP admin UI, but I’ve not used any of them.
thanks for this plugin
Rich:
I have installed the plug-in and have been playing with the reports. I only wonder if the whole point behind the release of Analytics is to train Google how to charge more for the best performing AdWords ads. Are there any other analytics programs you have seen that don’t report their findings to the advertising space vendor?
Best,
Jonathan
Thanks a bunch for this great plugin. It automatically attaches the code to all outgoing links and has proven very helpful in tracking page statistics. Not to mention it’s very easy to install.
THANK YOU! Great Plugin.
I just installed this, and it’s working perfectly. Kudos to you. Thank you!
Hi Rich,
I am using your plugin from three months and it works perfectly. But today I noticed a little but not fundamental bug. Your plugin modifies the html code in this way: when there is an hyperlink it don’t leaves no space by the href tag and the title tag. Furthermore It modifies the rss feed adding an onclick tag whose presence is not an error but it is a warming according to the wc3′s feed validator. Is it possible to correct it? I hope I have been clear because my english is not perfect. Thank you. Bye.
I’m a beginner and don’t know much about creating web pages. Navigating through the various files and folders of WordPress only furthers my confusion. So where do insert my Account Sting among my WordPress files? I was able to do it without any problems for my regular (non-Wordpress) pages.
Hi Rich,
I found the little bug and I solved it.
I added a space on line 219.
I also bypassed the feed validation by changing in the file wp-rss2.php (belong to wordpress) the function the_content with the function the_content_rss.
Thanks for your job!
Bye!
very usefull plugin, thanks
Hello,
I just installed this plugin, but after 30 minutes, google analytics is still showing as “Tracking not installed”.
Where exactly does this add the code?
Thanks!
Hi Rich,
Is it possible to modify the plugin so as it dont track when I access to my blog as Admin?
Thanks
Simple to install, simple to configure. Great plugin. Thanks.
I have installed the plug-in, it says it has the tracking code installed but when I log in to google analytics there are no statistics tracked. whats up?
Why do I get
Warning: Cannot modify header information – headers already sent by (output started at /home/opmr/public_html/wp-admin/admin-header.php:16) in /home/opmr/public_html/wp-includes/functions.php on line 2448
What can be the reason for that? Tried to find the answers in the post but no luck…
Thanks!
Hi Jean. It usually means there’s a space after the “?>” at the end of the plugin code, or in something else that you’ve edited. For example, see the codex.
First, thanks for this nice plugin
When the user install Adblock and block Google Analytics, the original code will cause Javascript error:
echo("urchinTracker();\n");Just check if it has been loaded:
echo("if (window.urchinTracker) urchinTracker();\n");Hi -
First Excuse my poor english , i ‘m french.
Thank you for this excellent plugin , but in my blog google analytics don’t detect my code …
however installation is really easy .. i don’t understand the problem. Can you help me ?
Thanks you for your help
And sorry for my mistakes
Amicalement.
I have the same problem as Mathieu
I think that we have to wait 24 h Mathiu
Hi rdg/mathieu,
Once you have installed, configured and enabled the plugin, Analytics should confirm that it has found the tracking code and is “gathering data”.
It then takes a little while before the data starts to appear – usually around 4 to 8 hours.
Mathieu, looking at the source code on your blog I can see that you’ve enabled the plugin, but not configured it, scrool back up to the installation instructions and check the penultimate bullet point.
RDG, your code looks fine, you shoudl be seeing stats anytime soon.
The forum is up and running for technical help so I’m going to turn comments off from here. Trackbacks are still welcome of course