Google Analytics plugin updated!

I’ve just updated my Google Analytics WordPress plugin to version 2.2, it “forces” you to switch to the new tracking code. Image tracking and AdSense tracking should still work. It requires the code to be in the head, as outbound link tracking will still not work correctly otherwise.

Before you install it, delete the old version, as some files have been removed. I’d appreciate all your feedback! Thanks go to Hugo Krantz for testing!

Update: multiple people said they wanted the code before the /body. Unfortunately, this help document says:

Important: if your pages include a call to _trackVisit, _setAllowLinker _trackTrans(), your Analytics tracking code must be placed in your HTML code above any of these calls. In these cases the tracking code can be placed anywhere between the opening <body> tag and the JavaScript call.

That’s why I left that possibility out, and placed the script in the place where it makes tracking most reliable: the head section.

Tags: ,


Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

20 Responses

  1. MassimoBy Massimo on 18 December, 2007

    Your quick! Great job once again!

    Massimo

  2. Robert IrizarryBy Robert Irizarry on 18 December, 2007

    Wow that was quick! Thanks! I’ll try it out and report back.

  3. MarkusBy Markus on 18 December, 2007

    Great, I have to test it! Thank you.

  4. Robert IrizarryBy Robert Irizarry on 19 December, 2007

    Just wanted to stop back in and quickly report that everything is looking good with the new plugin.

  5. Justin CutroniBy Justin Cutroni on 19 December, 2007

    Hey Joost,

    Thanks for the quick update! Just a quick note about your post. There is no _trackVisit() method. IT did exist in an earlier version, but it was replaced by _trackPageview().

    Justin

  6. Joost de ValkBy Joost de Valk on 19 December, 2007

    Ah Justin, that’s actually an error in the Google docs then? :)

  7. PaulBy Paul on 20 December, 2007

    Hi Joost,
    cool plugin; will install now.

    By the way: found your page while looking for a plugin that lets you display a list of the latest outgoing links on your blog. In my early blogging days on Movable Type I had a plugin that did just that, but I’ve never seen it for WordPress…
    Do you know of such a plugin?

  8. MarcusBy Marcus on 25 December, 2007

    Hey Joost,

    Thank you very much for this plugin. I was searching for it and dadaa, Google brought it up for me. :)

    Now, I’m a bit concerned since I cannot find an analytics string of code in the head section, as per your description above. Would you please tell me what kind of code should be there?

    All I could find was the “adsense-track.js” thing at the very end, right before the closing tag.

    Also, when I take a look into the plugin editor there is a string of code near the beginning that says $uastring = “UA-000000-0″;

    Is that not supposed to contain my analytics user account details instead of the 000000-0 ?

    Either way, thanks a million for creating this cool plugin!

    My best,
    Marcus

  9. Joost de ValkBy Joost de Valk on 25 December, 2007

    @Marcus: you’re probably logged in as an admin, by default it doesn’t track admins. If you’re logged out and it still does’t show, check if there’s a wp_head() call in the header.php file of your theme.

  10. MarcusBy Marcus on 28 December, 2007

    HA! That exactly is it. Once I’m logged out I can clearly see the code.

    Thanks a bunch, Joost, and Happy New Year! :-)

  11. Horner PeterBy Horner Peter on 31 December, 2007

    I work with version 2.0 because the new version 2.2 makes an invalid HTML check. I don’t know why, but in the header there in no validation problem and it counts fine.

  12. Joost de ValkBy Joost de Valk on 31 December, 2007

    @Horner Peter: invalid html check??

  13. MarteyBy Martey on 31 December, 2007
  14. Joost de ValkBy Joost de Valk on 31 December, 2007

    Ah ok, I’ll fix that with 2.3

  15. Horner PeterBy Horner Peter on 31 December, 2007

    Thanks for comming version 2.3 !

  16. John RBy John R on 4 January, 2008

    Thanks for the great plugin, I only wish I could get mine to work.

    I have 2.3 and put in my account number, but GA still says they don’t recognize the code on my page even though I logged out as an admin and can see it myself. The only difference in what’s on the page vs what Google provides is after the account number is listed in the code your code ends the script and starts a new one. The code GA provides just continues to the end without the additional script.

    Any thoughts on how I can get Google to recognize the code on my pages? I thought maybe someone else may have this issue so I’m posting here instead of contacting you directly.

    Cheers,
    J

  17. John RBy John R on 5 January, 2008

    Well, I just wasn’t patient enough. Apparently it takes Google 12-24 hours before it starts to notice the tags on your page. After about 18 hours they now say they are receiving data.
    thanks again!

  18. Joost de ValkBy Joost de Valk on 6 January, 2008

    Updated it again, and reminder for the next time: always read intensely what Justin Cutroni says :) You were spot on Justin about the pageview tracking, fixed that now!

  19. TedBy Ted on 8 January, 2008

    Hey, this may seem like a rather redundant question, but I have implemented the plugin myself (btw, many thanks for the great job) and I don’t seem to get Google to acknowledge that whatsoever, I waited for more than 24 hours, and I now the code is there, I can see it black on white and even if I refresh the site I can see the “waiting for g-a…” thing is firefox in the lower bar, so it is there.
    Is there anything I didn’t do? I mean all I did was activate the plugin… Sorry for the waste of time if my question seems stupid.

  20. TreyBy Trey on 11 January, 2008

    I’ve had this problem before with another plugin, but I can’t remember which.

    I activated installed and activated this as required, added my google account number.

    But when I got to “manage” my posts, they don’t show up. If I deactivate the plugin, they come back.

    It’s a strange behavior I have no idea how it happens.

    I have WP 2.3