Forum Moderators: martinibuster

Message Too Old, No Replies

Adsense tracking script and multiple ad units

Any issues with script and multiple ads?

         

ari11210

4:01 pm on Sep 9, 2004 (gmt 0)

10+ Year Member



Hi everyone,
A while back there was a lot of discussion about a good tracking script. Now that we can have multiple ad units, I was wondering if we need to revisit it. I've looked at the code and it seems OK, but wanted to get others opinions. The part of the javascript that I am concerned with is this:

var elements = document.getElementsByTagName("iframe");
for (var i = 0; i < elements.length; i++)
{
if(elements[i].src.indexOf('googlesyndication.com') > -1)
{
elements[i].onfocus = TrackIt;
}
}

It looks like it should pick up each ad unit and tell it to call 'TrackIt' on focus, does anyone out there see any problems with this? Possibility of missing clicks or double counting, etc?
Thanks for your help
Aaron

ari11210

4:05 pm on Sep 9, 2004 (gmt 0)

10+ Year Member



One more thought... Would it make a difference if this javascript was placed in the HTML before all the ad units were displayed? For example, lets say I have 3 ad units on the page and I place the javascript after the first one but before the other 2, is it possible that the script wont pick up the other 2 iframes when it loops through the iframes?

Thanks again
Aaron

ari11210

4:45 pm on Sep 9, 2004 (gmt 0)

10+ Year Member



Ive done a little testing and it seems that the loop would have to be at the bottom of the page (after all ad units) to pick up all the iframes correctly.

blue_eagle

12:47 am on Sep 10, 2004 (gmt 0)

10+ Year Member



my tracking script shows less click than the actual about % 20 - 30 less than actual clicks. Do you guys think it has something to do with second adsense banner?

Thanks

Jenstar

2:40 am on Sep 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For reference, here was the original tracking script URL:
[webmasterworld.com...]

ari11210

3:22 am on Sep 10, 2004 (gmt 0)

10+ Year Member



It depends on where you place the javascript, if you only place it after one ad then only that ad will be counted. You will need to place it after all the ads on your page.