February 23rd, 2007 WordPress Google Analytics Plugin
This plugin allows you to use the powerful Google Analytics to track your Wordpress stats. It’s easily configurable to:
- Not log anything in the admin area
- Log 404 errors as /404/{url}?referrer={referrer}
- Log searches as /search/{search}?referrer={referrer}
- Log outgoing links as /outgoing/{url}?referrer={referrer}
- Not log any user roles (administrators, editors, authors, etc)
Changelog
- 06/11/2008: 1.2.2
-
- Fixed problem with code affecting Admin Javascript such as the TinyMCE editor
- 06/08/2008: 1.2.1
-
- Bug fix for the stats gathering
- 06/08/2008: 1.2.0
-
- No longer parses outgoing links in the admin section.
- Uses get_footer instead of wp_footer. Too many themes aren’t adding the wp_footer call.
- Options page updated
- Added optional anonymous statistics collection
- 04/23/2008: 1.1.0
-
- Major revamp to work better with the new Google Tracking Code. It seems that outgoing links weren’t being tracked properly.
- 04/17/2008: 1.0.0
-
- Released to wordpress.org repository
- 07/03/2007: Version 0.0.2
-
- Fixed problem with themes that do not call wp_footer(). If you are reading this and you are a theme developer, USE THE HOOKS! That’s what they’re there for!
- Updated how the admin section is handled
studge Says:
Great idea! I am going to give this a try, thanks.
Sebastian Says:
Hi ! It seems the link to your file is broken.
Where can i download to try it ?
Aaron D. Campbell Says:
Sorry, the links were broken from when I moved this from xavisys.com/blog to aaron.xavisys.com. They should be fixed now.
Jane Says:
I have installed your plug in and entered my Google code in the Options section on wp, but after over an hour I am still being told that Google cannot find the code. Whenever I have used analytics before the code has activated within minutes, am I dong something wrong?
Aaron D. Campbell Says:
Did you paste the whole code that Google provides? It should look like this:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">
_uacct = "UA-XXXXXXX-X";
urchinTracker();
</script>
You should see immediate results, meaning that you should see the Google Analytics code appear in the code of the site. If you don’t, send me the address to the site through the Xavisys contact us form, and I’ll take a look.
Aaron D. Campbell Says:
As it turns out, the problem Jane was having was with her template, which did not include a wp_footer() call. She fixed her template, but I also made some changes to the plugin. If wp_footer is never called, it will use output buffering to insert the code just before your closing body tag.
Christiaan Conover » Five Wordpress Plugins to Make Your Blogging Year Better Says:
[...] Google Analytics: This plugin is crucial to me, perhaps above any of the others I use. I love Google Analytics - it’s so easy to use, and it gives you so much information. However, I sometimes get a little frustrated with it in conjunction with Wordpress. When I decide I want to switch themes, I have to go through and manually paste the tracking code into each appropriate theme file, which can be frustrating, especially when I realize days later that I missed one. Also, since I’m a frequent visitor to my own blog to make a new post or whatever other reason, that can skew the accuracy of the data being presented. I’ve used the filter feature in Analytics before, but I’m not always at the same location when I access my blog, so for me it’s not that effective. The Google Analytics plugin solves both these problems. It automatically inserts the tracking code you provide into all the pages, making sure that no page view is overlooked - except, of course, for the ones you tell it to ignore. It allows you to choose what user levels not to gather tracking data from, so you won’t see all the visits you (or other authors/admins) make to the site, resulting in a more accurate reflection of the visitors to your blog. This is a must-have for any serious Wordpress user. [...]
sharewp.info Says:
WordPress Google Analytics Plugin…
This plugin allows you to use the powerful Google Analytics to track your Wordpress stats….
24 godziny – co się zmieniło | Migol's Blog Says:
[...] trójca Google", czyli kolejno: All in One SEO Pack, Google XML Sitemaps oraz WP Google Analytics. Pierwsza z nich wspomaga optymalizację dla wyszukiwarek (nie tylko Google, ale wszyscy wiemy, [...]
tayfun Says:
super.
Ryan Says:
I am an idiot at this stuff. I have analytics on my normal site (i did not install it myself, but i use it a lot), and i am trying to get it to work on the blog. Where (exactly) do I paste the code? There are many php pages on the theme editor. Any help would be appreciated.
Aaron D. Campbell Says:
If you are using this plugin, you don’t need to mess with your theme. Install the plugin, then go into your admin section to settings and “Google Analytics.” Paste the Google supplied code in the box, and set the setting however you want. Click “Update Options”
Andrei Says:
same problem as Jane .. i pasted the code and no response from Google Analytics .. pls help
thanks!
Andrei Says:
problem solved .. is was google latency i suppose .. thx anyway!
cheers!
Aaron D. Campbell Says:
Glad to hear it Andrei!
WordSkill Says:
Aaron, thanks, a breeze to get working in 2.5. Keep up the good work.
brian jones Says:
installed the plugin, set my options, pasted google code, yet they cant verify. I have tried both the “new tracking code” and the “legacy code”. will the plugin work with the new code? what do you think the issue is?
thanks
brian jones Says:
never mind, the plugin conflicts with the slideshow on the front page and our galleries. i uninstall ed
thanks
Aaron D. Campbell Says:
Brian: Sometimes it takes a while for Google to verify that they are receiving data, but if you view the source of a page, you should see the Google Analytics code being added to the page.
The plugin works with both the new and legacy code.
How exactly did it conflict? What did it do? I’ll send an E-Mail to you as well, so you can reply there if you prefer.
Ryan Says:
Thanks. I do not know how i did not see that. It still does not work though. One question, my blog is located at myurl.com/blog. i already have analytics working on myurl.com. Do i need to register a different tracking address for myurl.com/blog????? Please help.
Ryan
Aaron D. Campbell Says:
Ryan: No, you don’t need to register a different key for the same domain. You have checked the source code of a page on your blog to make sure? You should see either the Google code, or something like:
<!-- Google Analytics Plugin is set to ignore your user role -->It hooks into the wp_footer hook, so you’ll need to make sure that your theme includes the proper wp_footer() call in the footer of the page (before the </body>).
Hopefully the last three lines of the footer.php file in your theme look like this:
<?php wp_footer(); ?></body>
</html>
Steve H Says:
Thanks Aaron this is a great Plugin, just thought i’d post and say the last four lines of my footer looked like this:
Put in the line like so:
and everything appears to be working
Steve H Says:
oops..
Thanks Aaron this is a great Plugin, just thought i’d post and say the last four lines of my footer looked like this:
Put in the line like so:
and everything appears to be working
ปลั๊กอิน : StatPress เก็บสถิติคนอ่านบล็อก Says:
[...] by W3Counter ก็ต้องมี ID เว็บ W3Counter , Google Analyticator หรือ WP Google Analytics ก็ต้องมี ID ใช้งาน Google Analytics ก่อน ( ID [...]
Speedtest: Google Analytics plugins | Binary Tendencies Says:
[...] WP Google Analytics 1.0.0 [...]
Converted my blog to Wordpress | YTechie.com Says:
[...] also set up the Google Analtyics Plugin, which sets up some pretty neat tracking features. It’s even supposed to track outgoing [...]
Converted my blog from Blogger to Wordpress | YTechie.com Says:
[...] also set up the Google Analtyics Plugin, which sets up some pretty neat tracking features. It’s even supposed to track outgoing [...]
Speedtest 2: Google Analytics plugins | Binary Tendencies Says:
[...] WP Google Analytics 1.1.0 by Aaron D. Campbell [...]
Laird Farquharson » Blog Archive » Blog Updates Says:
[...] WP Google Analytics: Use Google Analytics to track site statistics [...]
Robbie Says:
Great plugin! An additional feature that I would be interested in would be to be able to block out certain IP address (or even better dynamic dns names) from reporting. That way my statistics won’t be skewed by my own viewing from home or work.
Something Unimportant » Blog Archive » Mephisto to WordPress Says:
[...] I’ve managed to migrate my articles, add Google Syntax Highlighter, Google Sitemap, and Google Analytics along with some simple PHP tweaks to this cool theme over the course of 2 short nights. This entry [...]
chris russo Says:
Good work ppl!!
Orange Says:
Hi,
Great plug-in! Thanks for sharing!
I face a little problem with it. I have the blog on a dedicated domain (let’s call it http://www.myblueblog.com) and I have headers linking to this domain on a different site (let’s call it http://www.thatothersiteofmine.com). Now when the user clicks the banner on that other site and visits the blog, Google Analytics shows all page views originating from my blog site (www.myblueblog.com) which is wrong. Any idea what might be the cause?
Many-many thanks!
Aaron D. Campbell Says:
Robbie: Thanks for the idea, I added it to my list of TODOs for this plugin!
Chris: Thanks.
Orange: I’m not sure I followed exactly, maybe you could contact me directly and give me links to the sites in question?
bliss Says:
hi aaron,
i installed the plug-in and pasted the analytics code into the options area, but for some reason google analytics is telling me that the tracking code is not verified. i have the whole:
in my footer.php file and i can’t figure out the problem. help! (please)
Azra Says:
I had a weird issue, when the google analytics plugin was enabled, tinymce was stuck in html editting mode.
Marcus Says:
Hi. I’ve read all the posts here.
I wont get it to work. Ive waited, I’ve tried reinstalling everything and installing and wating again. It wont work. The code don’t appear in the template page as you say it would. I currently have my site being built so you cant explore it sorry. I use a theme and everything is up and running. But the plugin wont work.
What do you think the problem could be?
I have like 5 other sites on google analytics.
T. Bishop Says:
Installed the Wordpress plugin and it works great after adding the
line before thein the footer.php file.Thank you.
Caleido Says:
OK…here’s my issue..
I’ve updated the plugin into the most updated version.
I’ve installed, tried both of analytics tracking code and it doesn’t work. The status in my analytics mentioned to be not verified. I don’t understand what’s the problem. I’ve checked the php code of footer.php and the code (footer.php())is there…
The only thing is I’m using others created template and can’t modify the template. there’s some docs at codex explaning about chmod and .htaccess file. I don’t really understand it at all and haven’t try anything yet.
Is there any possibility of this became the main issue why analytics code using this plugin doesn’t work??
Hoping for any enlightment…Thx
links for 2008-06-13 « RabiFoot at wordpress.com Says:
[...] WordPress Google Analytics Plugin · Xavisys (tags: wordpress google plugin) [...]
ChuckMcB Says:
Getting an error after updating to v1.2.2:
Warning: include_once(/xxx/public/wp-content/plugins/wp-google-analytics/) [function.include-once]: failed to open stream: Inappropriate ioctl for device in /xxx/public/wp-settings.php on line 357
Warning: include_once() [function.include]: Failed opening ‘/xxx/public/wp-content/plugins/wp-google-analytics/’ for inclusion (include_path=’.:/xxx/apps/php5/lib/php/:/xxx/apps/php/lib/php/’) in /xxx/public/wp-settings.php on line 357
Aaron D. Campbell Says:
ChuckMcB: It looks like that might be a problem with safe mode (something set up by your host), and as far as I know is not specific to my plugin. Try making sure that the permissions are right on the files, and if you updated using the automatic update option, be careful of using it on other plugins, or you could have the same problems with them.
zplits Says:
Hello there everyone, I am completely new at wordpress. I have downloaded and activated your plugin in my wordpress blog. But when i log in to my google analytics account, in the status, google says Tracking code not verified.
Could you please help me on this? I’m a complete beginner.
Thanks in advance
Aaron D. Campbell Says:
zplits: It can take a little time, I usually give it a day. However, depending on how you have the settings, you will also need to make sure that you visit your blog in such a way that the code it loaded. So, if you ignore admins and you are an admin, you will need to visit the site when not logged in to make the plugin load the Google JavaScript.
I visited the site you linked to, and the code is being inserted correctly, so now just give it a little time.
zplits Says:
Hello Aaron, good day.
thank you very much. The script is already running. I really appreciate your help. thank you very much
Marko Kaartinen Says:
I suggest that you change the code a bit.
There is a & sign in line 181 and to get valid xhtml code you should change it to
&:$char = (strpos($track['data'], ‘?’) === false)? ‘?’:'&’;Marko Kaartinen Says:
oh great… this allmost worked…
The change should be & amp;
5 WordPress Plugins That Make Life Easier : Spontaneous Derivation Says:
[...] 5. WP Google Analytics [...]
Xavisys Development Site » Blog Archive » Google Analytics plugin 1.2.0 released! Says:
[...] discuss this plugin on the WordPress Google Analytics Plugin [...]
Xavisys Development Site » Blog Archive » WordPress Google Analytics 1.2.2 Released! Says:
[...] discuss this plugin on the WordPress Google Analytics Plugin [...]