OpenX Blog

Google Adsense click tracking patch…

Tags: Developers, OpenX
by Chris Nutting on December 18th, 2008

If you run Google Adsense ads on your site, you might have noticed OpenX has stopped counting clicks for your Adsense campaigns. This is because of a modification that they made to their tag (they moved the domain from ‘googlesyndication.com’ to ‘googleads.g.doubleclick.net’)

Because Google doesn’t support 3rd party click tracking we had built some clever JavaScript to track clicks in these ads. However, the JavaScript we wrote wasn’t quite clever enough to detect and update itself when the Google delivery URL changed :)

Thanks to those in the community that reported the issue (we raised a ticket here). The fix for this will be in the next releases of OpenX v2.6 and v2.7, but if you cannot wait, you can patch your server by replacing (path to openx)/lib/max/Delivery/google.php on your server with this one.

The JavaScript library may be cached for up to one day in your user’s browsers, but after that clicks will start to be logged again.

27 Comments »

  1. Thank you OpenX.
    OpenX rocks!!
    :)

    Comment by Techpark — December 21, 2008 @ 6:07 pm

  2. Indeed, great reactivity.

    Merry X-mas and Happy new year. ;)

    Comment by Wiak — December 24, 2008 @ 9:20 pm

  3. to be on the safe side, i have disabled click tracking for adsense as they’ve said not to mess with the code, are you sure it is not going to be a problem if i enable tracking? i was going to email adsense support but if someone has the answer here it would be nice.

    Comment by luq — December 25, 2008 @ 4:45 pm

  4. We have built click tracking so that it does not modify the Google Adsense tags. For the techies out there, this means that a click does not redirect through OpenX before going on to Google - it just notifies OpenX when you click on a Google ad.

    Comment by Scott Switzer — December 26, 2008 @ 4:10 am

  5. Thank you :) so now its ok?

    Comment by lin — December 26, 2008 @ 3:42 pm

  6. thanks for the reply scott, i’ll probably be enabling click tracking for adsense as well then.

    Comment by luq — December 26, 2008 @ 3:55 pm

  7. I updated with the patch but it seems to be counting twice each click

    Comment by Greg — December 29, 2008 @ 2:25 pm

  8. Hi Greg,

    Did you completely replace the google.php file or did you edit the code?
    Make sure you’re using exactly this code:
    https://svn.openx.org/openx/branches/2.6/trunk/lib/max/Delivery/google.php

    Comment by Arlen Coupland — December 31, 2008 @ 3:05 pm

  9. It’s what i did. I just replaced file with this one

    Comment by Greg — January 2, 2009 @ 10:47 am

  10. Assumedly OpenX Hosted now has the Adsense patch?

    Please confirm.

    Comment by Miamiman — January 5, 2009 @ 3:52 am

  11. well i m looking for a official(QA passed) patch in openx 2.6.3 that would allow me to track AdSense CLICKS.

    I made some changes to my google.php file as suggested, however clicks aren’t monitored….
    help !!!

    ——————————————————————————————————
    <?php

    /*
    +—————————————————————————+
    | OpenX v${RELEASE_MAJOR_MINOR} |
    | =======${RELEASE_MAJOR_MINOR_DOUBLE_UNDERLINE} |
    | |
    | Copyright (c) 2003-2009 OpenX Limited |
    | For contact details, see: http://www.openx.org/ |
    | |
    | This program is free software; you can redistribute it and/or modify |
    | it under the terms of the GNU General Public License as published by |
    | the Free Software Foundation; either version 2 of the License, or |
    | (at your option) any later version. |
    | |
    | This program is distributed in the hope that it will be useful, |
    | but WITHOUT ANY WARRANTY; without even the implied warranty of |
    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
    | GNU General Public License for more details. |
    | |
    | You should have received a copy of the GNU General Public License |
    | along with this program; if not, write to the Free Software |
    | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
    +—————————————————————————+
    $Id$
    */

    /**
    * @package MaxDelivery
    * @subpackage google
    * @author Matteo Beccati
    */

    /**
    * This function outputs the javascript code to track Google Adsense banners
    *
    */
    function MAX_googleGetJavaScript()
    {
    $conf = $GLOBALS['_MAX']['CONF'];

    $ag = file_get_contents(MAX_PATH.’/lib/max/Delivery/templates/ag.js’);

    $from = array();
    $to = array();
    foreach (array(’click’, ‘frame’) as $k) {
    $v = $conf['file'][$k];
    $k = strtoupper($k);
    $from[] = “@@F_{$k}@@”;
    $to[] = $v;
    $from[] = “@@F_{$k}_PREG@@”;
    $to[] = preg_quote($v, ‘/’);
    }
    foreach ($conf['var'] as $k => $v) {
    $k = strtoupper($k);
    $from[] = “@@V_{$k}@@”;
    $to[] = $v;
    $from[] = “@@V_{$k}_PREG@@”;
    $to[] = preg_quote($v, ‘/’);
    }

    // ctDelimiter
    $from[] = “@@OA_DELIM@@”;
    $to[] = $conf['delivery']['ctDelimiter'];

    // Supported networks
    $from[] = “@@OA_DOMAINS_PREG@@”;
    $to[] = “googlesyndication\.com|ypn-js\.overture\.com|googleads\.g\.doubleclick\.net”;

    $ag = str_replace($from, $to, $ag);

    return $ag;
    }

    ?>

    Comment by Ajay Singh — January 18, 2009 @ 4:50 pm

  12. the only changes made i think was appending ‘|googleads\.g\.doubleclick\.net’

    coz Adsense domain is changinf from syndication to doubleclick right?

    Are there any other changes i need to make?

    Comment by Ajay Singh — January 18, 2009 @ 4:53 pm

  13. Please note that this particular patch did not make it into the security fix version 2.6.4 that was released on January 29, 2009.

    Comment by Erik Geurts — February 1, 2009 @ 2:18 pm

  14. Thanks for the heads up Erik.. I was wondering why I no longer had clicks being tracked on my google ads served..

    Comment by Duro — February 10, 2009 @ 11:45 pm

  15. (sorry for the double posting… I made a mistake because I had both posts in different tabs)

    I’m starting to see some problems… according to OpenX (after patching it with this file), I’m getting something around 74 clicks on my Google adsense on ONE day… but according to Google, I only got 25.

    Am I missing something? Is Google cheating (or not saying everything)? is OpenX tracking something else?

    Has anyone seen similar issues?

    Comment by Moises — February 11, 2009 @ 2:13 am

  16. mee too, openx shows 1200 clicks where as adsense shows onefourth of it :(

    Comment by ajay singh — February 16, 2009 @ 11:02 am

  17. I am noticing the same issues.
    Google is registering less clicks on adsense then what openx is registering. This is a rather alarming issue and has seemed to cut my revenue in more then half. This needs to be addressed.

    Comment by James Peterson — February 16, 2009 @ 2:31 pm

  18. I apllied the patch and everything worked until about mid Feb. Then OpenX started tracking only a fraction of the clicks (about 10%). I upgraded and applied the patch again but OpenX only sees about 10% of the clicks reported by Adsense. googleads.g.doubleclick.net is definately in the patch.

    Comment by joe — March 2, 2009 @ 12:57 am

  19. Hi all

    Is happening to me the same that to Joe (comment March 2, 2009). I installed the patch with 2.6.3 version and was work.

    But now OpenX only seed about 10% of the clicks reported by Adsense. I upgraded to OpenX 2.6.4 version and the adsense track isn’t working.

    Are there any solution?

    Thanks

    Comment by Empleo — March 9, 2009 @ 2:10 pm

  20. It appears in my 2.6.4 install that Adsense tracking has stopped working again.. This occurred a couple of days (maybe a week ago..)

    Just wondering if the bug report:https://developer.openx.org/jira/browse/OX-4670 needs to be reopened..

    I’ve also appended this info in the forum: http://forum.openx.org/index.php?s=&showtopic=503424114&view=findpost&p=85232

    Comment by Duro — March 20, 2009 @ 1:25 am

  21. These are all very good points. Obviously, you guys are all passionate about this.

    Comment by Acai — April 24, 2009 @ 5:59 pm

  22. I keep listening to the news speak about getting free online grant applications so I have been looking around for the best site to get one.

    Comment by Online Porn Business — April 27, 2009 @ 7:42 pm

  23. Just a quick note to say Hi and thanks for the post.

    Comment by Lisa — May 2, 2009 @ 2:27 pm

  24. Nice post! GA is also my biggest earning. However, its not a much.

    Comment by Fred — May 6, 2009 @ 1:15 pm

  25. Ho read it :P :D

    Comment by ebay kuriko — June 1, 2009 @ 5:45 pm

  26. Anybody know if I wanted to bookmark this blog do I have to setup a Magnolia account first?

    Comment by Anthony — July 19, 2009 @ 10:10 pm

  27. ну так какие заработки то в этой теме? сабж не раскрыт…

    Comment by Pelez — July 20, 2009 @ 8:21 am

RSS feed for comments on this post. TrackBack URL

Leave a comment