WordPress Google Analytics 2.3: XHTML strict
After all the ASP and XHTML strict validation issues with Google Analytics, Google updated the default generated script code. I've now updated the Google Analytics for WordPress plugin to version 2.3, which uses this new code. You should really upgrade!
Next to that: I'd like to hear from you on which new features you'd like in this plugin, so if you have anything you want me to add, drop it in the comments!





by Martey on 2 January, 2008 at 19:38
Version 2.3 still breaks XHTML validation on my website. When outbound link tracking is enabled, a footnote on my first entry (which is an internal link to a bookmark elsewhere on the page) causes strange things to happen to the onclick. Joost, I can email the source to you if you are interested.
Also, the link tracking in my sidebar seems to be generating an extra " at the end of the onclick attribute.
by tirm on 5 January, 2008 at 11:03
Function _trackVisit is incorrect Google messed up the documentation. You should change it to _trackPageview();
by gus on 6 January, 2008 at 17:09
Great plugin, but a little unclear on this: We've got version 2.3 running, and (almost) every link now has onclick="javascript:pageTracker._trackVisit('/outbound/typeoflink/nameoflink');" after it. If I understand the comment above and one on the 2.2 announcement post correctly, this is wrong? Because Google Analytics is working, but not tracking outgoing links.
I had understood this had been fixed in 2.3, but apparently not? If it hasn't been, where in the code should I change _trackVisit to _trackPageview();? Or do we just need to wait for the next update for this to work?
A second question: we've got a direct ad I'm trying to track clicks on, which is neither an article nor a blogroll link nor any of the other categories the plugin automatically sets up. How do I do it? Do I manually insert the onclick code into the anchor, or will that mess something up in the plugin? Or is there a class I can put on the link to put it into one of the categories that gets tracked? Or is there some way I can add "ads" as a new category for tracking?
by Joost de Valk on 6 January, 2008 at 22:24
Ok, please upgrade to 2.4, I've fixed both the trackPageview issue, which, gus, you were right on, and the XHTML is not broken anymore even with outbound link tracking on.
by gantico on 7 January, 2008 at 10:50
Thanks for the update, I was wondering why it wasn't notified by the plugins page in WP admin page. The other plugins usually tell you when an update is available.
by Joost de Valk on 7 January, 2008 at 10:52
That's cached inside WordPress, so sometimes it takes a little while to update... It should work though.
by gantico on 7 January, 2008 at 11:08
I forgot to say that I appreciated your great plugin: I donated 1$ and I added it to my top ten list of WordPress plug-ins:
http://www.gantico.com/blog/2007/12/wordpress-plugins/
Happy New 2008!
by tirm on 7 January, 2008 at 11:15
hmm. I see _trackVisit in adsense-track.js
googleanalytics.php realy fixed
by Joost de Valk on 7 January, 2008 at 11:33
You're so right tirm... Thx for noticing! 2.4.1 fixes that :)
by tirm on 7 January, 2008 at 20:49
where I can download 2.4.1? :)
by Joost de Valk on 7 January, 2008 at 20:51
here, as always.
by tirm on 7 January, 2008 at 21:03
Thanks Joost
by Austin on 12 January, 2008 at 21:46
I LOVE the way you have put together this Analytics for WordPress plugin! I'm not a programmer, but it's a really cool product and worth supporting. However, I just installed 2.4.1 and have tried over and over to "Check Status" from Google, and I still get "Tracking Unknown". If it's just me, then no big deal, but I thought I'd let you know because maybe something has changed in the last few days that messed with things. Thanks.
http://www.wheneverday.com
by Austin on 12 January, 2008 at 21:53
Wow, how 'bout a donation to the cause! I figured out that I hadn't put in the full "http://" within Google Analytics. I hate being one of 'those' guys. :-)
Thanks again!
by pat on 13 January, 2008 at 04:55
Hi, I'm having a bit of trouble installing this plugin - forgive me if I'm just being dumb, but I downloaded it and saved in my wp-content/plugins directory, but it does not appear in my wordpress plugins page
Any help would be appreciated, thanks!
by pat on 13 January, 2008 at 05:02
Ok - I obviously jumped the gun a little bit. I now know that I just have to move the 'gapp' folder into wp-content/plugins. It might be a good idea IMO to change it so that you move the whole folder, as it makes installation a little easier/ slighty more standard.
Thanks for the plugin!
by ph on 13 January, 2008 at 23:55
Anyone else having problems with outbound link tracking when the complete outbound URL is being tracked? I'm using 2.4.1 with WP 2.3.2. When I start drilling down in GA, I get to /content/articles, for instance, and then underneath there are just a couple of entries for /http:/ and /https:/ with nothing underneath them. Is there a problem with the URL parsing code?
by Joost de Valk on 14 January, 2008 at 01:13
@austin & pat: glad you both got it working :)
@ph: that's an issue indeed, I'll make sure the next version removes all http:, https:// and www's :)
@john morris: my pleasure :)
by Tracy Evans on 11 February, 2008 at 05:33
Newbie question - If I start using this plugin (and delete the code I originally inserted into my pages to activate GA), will I loose the GA stats I have already gathered? Am I starting from scratch with my GA data? Thanks!
by Joost de Valk on 11 February, 2008 at 20:17
@Tracy: no it won't.
by bob on 24 April, 2008 at 03:34
Forgive me for asking, but why use the plugin when you can simply copy and paste the code Google provides you?
by Scott Johnson on 3 May, 2008 at 06:27
It seems that the code for detecting the plugin path in this plugin is not bulletproof. You can see it in action on my site. With my WordPress setup, it's causing a script src="adsense-track.js"...no path to the script.
by Scott Johnson on 3 May, 2008 at 06:32
I'm also seeing in another instance:
script src="/apps/wordpress/plugins/google-analytics-for-wordpress/custom_se.js"
Where /apps/wordpress/plugins is where my global plugin repository is for that server. The actual plugin directory wp-content/plugins contains symlinks to the items in the plugin repository. In this case, /apps/wordpress is not accessible to the outside world directly. Users are getting 404s as a result. :(
by Scott Johnson on 3 May, 2008 at 07:20
Joost, I'm just going to email you some recommended fixes. :)
by Richard on 28 May, 2008 at 03:49
Installed. Added url to google. Copied google code number to installation. logged out as Admin. Checked with google and found that it couldn't verify the code on my home page. Checked the source of the home page and found the code in the header rather than near the tag. The adsense tracking code was there however. Have deactivated the plugin.
by Joost de Valk on 28 May, 2008 at 06:10
@Richard: the script installs itself in the header for some very good reasons, especially if you want to be able to track outbound clicks it sort of needs that.
by Richard on 28 May, 2008 at 15:33
Thanks Josh. I understand your reasoning but my research since having this problem shows me that installing in the header can delay the loading of web pages and is not advised by Google. At any rate google couldn't find your code on my pages so slow or fast isn't an issue. :)
by Jon on 12 June, 2008 at 11:14
Thanks for a brilliant plugin Joost (and for all your articles on WordPress and SEO, they've really helped a 'newbie' get up to speed quickly)!
A suggestion for an additional feature for the plugin - could you add an option to create the page that Google mentions in its help-tip on how to filter "internal users" from the statistics?
See - https://www.google.com/support/googleanalytics/bin/answer.py?answer=55481&hl=en_US - the second option, "Exclude traffic by Cookie"
Thanks again
Jon
by newbie on 30 September, 2008 at 23:13
Just wanted to find out if the Google script is placed in the header or footer. I also thought you would want to check out your speedtest: http://binarytendencies.com/tests/speedtest-2-google-analytics-plugins/.
Thanks.
by Vincent on 15 October, 2008 at 14:11
hi Joost,
I was wondering if this plugin has advantages if you have Headspace2 installed. Headspace2 adds a lot of flexibility for meta tags, titles and so on. You have advised to use this also in your SEO WP optimisation page. In Headspace, I can also add my Google code.
I am interested in the bonus to install this plugin together with Headspace, or worse if it would interfere? Is your plugin adding the analytics for downloads and outgoing links as a bonus? or this is in headspace too?
Hope you can clear it up for me :)
cheers
by Crazy2 on 1 November, 2008 at 13:40
With the 2.6.3 version and using outbond. i still doesnt get XHTML valdation.
How can i fix?
by Max on 19 March, 2009 at 09:15
This question might sound a little stupid, since it appears that everyone understands what you are talking about... but no.. not me.. what is a "gapp" folder???