Welcome to WebmasterWorld Guest from 54.145.176.252

Forum Moderators: incrediBILL & martinibuster

Message Too Old, No Replies

developing AdSense tracking script

what do you think of tracking AdSense independently?

     
9:44 am on Feb 25, 2004 (gmt 0)

New User

10+ Year Member

joined:Feb 25, 2004
posts:7
votes: 0


Hello,

I have seen posts that wish detailed AdSense reports such as site level or page level stats.

Currently, we are working on a script to track AdSense impressions and clicks. The script lets you track the stats of sites, pages, referrers, color combinations, ad formats, visitor countries, paid or alternate ads displayed etc.

To remove questions, it conforms to Google TOC completely. No change to AdSense code, no interference.

I want to know your opinions on tracking AdSense independently. Do you personally want to use such a script? What features would you expect?

Thanks

10:12 pm on Feb 28, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 7, 2003
posts:408
votes: 0


I'm sure everybody agrees that Google has the technology to provide us real-time stats, per domain and even per page.

They must have GOOD reasons why they don't give us this information.

Apparently, there is now a way to circumvent this problem.

I'm curious how Google will handle this...

10:39 pm on Feb 28, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:July 14, 2003
posts:581
votes: 0


I hope I was clear that I doubted many users would inadvertently or maliciously trigger false-positives in the way I suggested. How many users hold their mouse button down, then decide not to click? And how many enemies decide to screw up your internal click tracking stats when they can just as easily do worse? I think the error rate would be low enough that the stats would still be useful to me as a publisher. I'm only interested in stats so I can analyze them and make better business decisions so consistency and understanding the limitations are more critical to me than 6-sigma accuracy. I wasn't even going to mention it, but I changed my mind b/c I thought there might be other flaws in the code or incapatabilities with other browsers and I felt that I needed to share what I found so others can dig deeper.
10:57 pm on Feb 28, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 21, 2003
posts:159
votes: 0


And how many enemies decide to screw up your internal click tracking stats

For this reason I've now encrypted the javascript.

I have some "friends" who would love to run the "as.asp=www.some-url.com&url=www.an-other-url.com" sting on my sites! (for fun!)

After encrypting the code I made it a bit harder for them to find the needed data!

Noel

11:19 pm on Feb 28, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 24, 2002
posts:1209
votes: 0


No need to verify, ASA said everything is A OK and he speaks for Google.

Actually, when ASA said that they thought it would be ok to run a click counter script, it wasn't at the same point in the discussion as it is now.

ASA said that they couldn't comment on any script in particular.

It would be interesting to see a further comment now that the script has progressed, and talk of a third party tracking server (where you would have to give pass your stat information to).

It seems to be a different animal now, than was first commented upon.

1:20 am on Feb 29, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 10, 2003
posts:67
votes: 0


But if you're not modifying the code, or trapping the clicks or changing the way ads are processed, it should be all right to implement a click-counter script like the ones suggested.

Do be careful not to change the ad code without realizing it, though.

Yes it was, the point has not changed.

2:15 am on Feb 29, 2004 (gmt 0)

New User

10+ Year Member

joined:Aug 24, 2003
posts:34
votes: 0


richmondsteve wrote:
By moving the mouse off of the link and releasing the button it was logged without ever actually following the link

I have noticed that right clicking the ad will also trigger the script.

3:03 am on Feb 29, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 23, 2003
posts:670
votes: 0


I would guess that Google will release its own domain or page reporting quite quickly now that this is out.
6:40 pm on Feb 29, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member jomaxx is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 6, 2002
posts:4768
votes: 0


I've got this script running live and it rocks! But for now I really only see the need to run it on a second site I'm currently testing AdSense on.

I commented earlier that I wasn't seeing the URL, and that I didn't think it was possible to display the window status bar that the browser displays on mousover - only if you set it explicitly.

Well, I just realized the answer was staring me right in the face. Google DOES explicitly set window.status, because they hide the raw link with that "go to www.domain.com" status message. My testing with the AdSense code was limited to clicking on the "Ads by Google" link, where they don't do that. Duh!

9:14 pm on Feb 29, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 23, 2004
posts:435
votes: 0


Well, though I wasn't going to be back until Monday, I logged in today to setup a few people who volunteered for beta testing AdSense tracking accounts. I was floored to see dozens of new posts on this topic! How cool! This is the first thread here that I'm a major contributor to that has gotten a ton of posts--is that some kind of status symbol? ;)

I will be adding CTR info to the script and trying to work out some of the few (and minor, but real) bugs in the tracking (such as right-clicking). It will be easy to figure out whether the onfocus was triggered by a right-click or a left-click, and trapping that accordingly. So thanks to crxchaos for that. I'll post the code here once it's done.

As far as whether it's "safe" to let a third party manage your AdSense data, I agree with whoever it was that said if you let a third party manage your traffic statistics you're "in jeopardy" according to those thoughts.

In fact, if looked at from that perspective, unless you have your own server that you maintain, all of your data is sitting on somebody else's hardware, accessible to whoever it is that is hosting your site. So I personally don't have a problem with letting somebody else manage my data if the service is reliable.

12:18 am on Mar 1, 2004 (gmt 0)

New User

10+ Year Member

joined:Aug 24, 2003
posts:34
votes: 0


I think this modified code should eradicate the 'click-drag' and the 'right-click' bugs. But I foresee it spawning a 'hover-refresh' bug :(

<script language=javascript>
function log()
{
if (window.status.indexOf('go to') == 0)
{
bug = new Image();
bug.src = 'as.asp?ref=' + document.location + '&url=' + window.status.substring(6);
}
}
document.body.onunload = log;
</script>

If it is possible to test whether the iframe has focus when the log() function executes it should be almost foolproof but my javascript/DOM knowledge doesn't extend that far.

On my (low traffic) site I'm already seeing approx. 100% more clicks reported from this tracking than Google's! As I deal with such low numbers each day I can also infer the CPC of each site, lost earnings from 'filtered' clicks, etc.

Although some might scoff at the actual value of having this data as a publisher, it sure is interesting :)

1:52 pm on Mar 1, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 23, 2004
posts:435
votes: 0


It's important that, although you call your server-side script for each click, you also take note of unique IP's and when they click the same ad. I don't know for sure, but I'm pretty sure that Google will filter out a visitor from the same IP clicking on the same ad in a given time period (perhaps 24 hours). So if you only use the raw data without doing some appropriate filtering, the numbers will be high.
2:58 pm on Mar 1, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 16, 2002
posts:1404
votes: 0


I am not going to admit to running the script or not running the script, but I do have something to say:

"God bless those AOL users"

I am now taking bets on when it is that Google comes out with its own tracking system. The closest to the date wins a link from my site to theirs as long as it is not "PRON" for a couple of months. Nope not on the homepage :)

My guess: May 24th 2004

2:59 pm on Mar 1, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member trillianjedi is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 15, 2003
posts:7249
votes: 0


March 25th

TJ

(Not interested in the link, but I'll take the glory ;-))

3:32 pm on Mar 1, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 23, 2003
posts:670
votes: 0


I'll take that on. How 'bout March 8th?
3:54 pm on Mar 1, 2004 (gmt 0)

New User

10+ Year Member

joined:Aug 15, 2003
posts:36
votes: 0


I've developed a commercial script to track adsense clicks on sites. The javascript it's a bit more advanced than the one placed here (it handles better the iframe focus, preventing erroneus duplicated clicks, and recording several clicks on the same ad).

The PHP script supports all AdSense languages (English, Spanish, French...) so all clicks are accounted. It filters out clicks on the same ad from the same IP... The thing is in the first whole day (the script time zone is the same used in AdSense) the script only accounted 4% less clicks than in my AdSense account.

The script returns advanced stats: domains, files, ads clicked, ips, ids (used for distinct random ad styles in our case). Stats by day and by hour. It allows discrimination by time period and domain/file/ad/ip.

So you can, for instance, control what ads are most clicked, when, where and by whom, what ad style is better for every domain/file...

If someone is interested, please PM me.

[edited by: kaijohannkursch at 4:03 pm (utc) on Mar. 1, 2004]

3:54 pm on Mar 1, 2004 (gmt 0)

New User

10+ Year Member

joined:Jan 12, 2004
posts:18
votes: 0


I don't think that even Google can work THAT fast! I'll put my ticket in for April 1st (seems appropriate!).
4:20 pm on Mar 1, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 10, 2003
posts:67
votes: 0


March 28th!

As for the commercial tracking product, why not be a pal and release it for free. Eventually, (very soon at this rate) a script will be released that will do the same or better.

So give it up and be a hero for a day.

4:40 pm on Mar 1, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member jomaxx is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 6, 2002
posts:4768
votes: 0


Yeah, MANY THANK to those who posted code without trying to profit from it. You guys rock!
4:52 pm on Mar 1, 2004 (gmt 0)

New User

10+ Year Member

joined:Aug 15, 2003
posts:36
votes: 0


Well, the script I'm talking about it's mainly the PHP script that saves the data and generates the stats. The javascript code is peanuts:

function hit(){
window.focus();
if (window.status){
img = new Image();
img.src = 'http://domain.com/tracking.php?ref=' + escape(document.location) + '&title=' + escape(document.title) + '&ad=' + escape(window.status) + '&id=****';
};
};
document.getElementById("google_ads_frame").onfocus = hit;

Advantages:
- The window.focus blur the focus from the iframe, so the script handles better erroneus/true duplicated clicks.
- The "go to" is not included in the js, so ALL ad languages are supported. The window.status decide if an ad has been clicked or not.
- The escape in the url parameters avoids querystring problems.
- The script does not use the innecesary loop to catch the iframe.

5:00 pm on Mar 1, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member jomaxx is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 6, 2002
posts:4768
votes: 0


Thanks. I love this place.

By the way, I checked my results for the first day and I detected NO clicks from Netscape users. Nor Opera nor Mozilla nor that new Mac browser whatever it's called. 100% MSIE. Without giving anything away, lets just say I would have expected to see some other browsers, statistically.

5:01 pm on Mar 1, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member trillianjedi is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 15, 2003
posts:7249
votes: 0


Nice additions - thanks for posting.

The .php stat generation and logging is pretty easy. I'm sure we'll also be doing something along those lines over this week. Code will definitely be placed here, community spirit is what this place is about.

Maybe better or worse than other peoples, but having a large pool of ideas and implementations I'm sure will result over the coming months into a seriously honed tool that we all can use to our advantage.

That's what is so great about all the code postings on here so far - you can pick and choose the best of everyone's to tailor to exactly what you're after for your own particular need.

TJ

5:18 pm on Mar 1, 2004 (gmt 0)

New User

10+ Year Member

joined:Aug 15, 2003
posts:36
votes: 0


The .php stat generation and logging is pretty easy

No comments, I'm willing to see those future scripts...

5:30 pm on Mar 1, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member trillianjedi is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 15, 2003
posts:7249
votes: 0


The script returns advanced stats: domains, files, ads clicked, ips, ids (used for distinct random ad styles in our case). Stats by day and by hour. It allows discrimination by time period and domain/file/ad/ip.

The only thing we personally don't need for our sites is your "ids" thing (but seems like a straightforward enough idea - a good one though).

I'm not sure what you're doing in your script that you feel warrants non-disclosure, but I can assure you all of the .php-ers I know of here can build this, quickly and very easily. I'm not a php coder (although am a programmer) and even I could build this. Perhaps you feel you've come up with a very clever filtering algo or something.

The next week to 10 days on this thread are set to be very interesting I think.

TJ

5:57 pm on Mar 1, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 21, 2003
posts:159
votes: 0


kaijohannkursch,

I'm not sure if I did something wrong, but your javascript is still registering "right clicks" on the ad!

Noel

6:08 pm on Mar 1, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member jomaxx is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 6, 2002
posts:4768
votes: 0


>> The "go to" is not included in the js, so ALL ad languages are supported.

kaijohannkursch: Excellent point! Just wanted to point this out in case others miss it. I think you could also test for a nonblank window.status, so that clicks on "Ads by Google" don't show up in the report.

6:13 pm on Mar 1, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 25, 2002
posts:776
votes: 0


passing Ad style (dimensions, colors, etc.) to the webbug is a good idea.

I wonder, though, if it can be more automated. For example, can JavaScript pick the dimensions off of the iFrame?

6:26 pm on Mar 1, 2004 (gmt 0)

New User

10+ Year Member

joined:Aug 15, 2003
posts:36
votes: 0


I'm not sure if I did something wrong, but your javascript is still registering "right clicks" on the ad!

Reporting is more accurate allowing right-click.
Think most people use right-click to "open in a new window" or "copy shortcut".

I think you could also test for a nonblank window.status, so that clicks on "Ads by Google" don't show up in the report

Clicks on "Ads by Google" are not counted.

but I can assure you all of the .php-ers I know of here can build this

OK, every application made by every programmer is exactly the same to similar applications made by other programmers... Then we all programmers should earn the same salary! :P I've been developing professional applications for years and I can assure you not all applications are the same (luckily).

I'm not trying to convince all about anything, just another point of view.

[edited by: kaijohannkursch at 6:32 pm (utc) on Mar. 1, 2004]

6:28 pm on Mar 1, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member trillianjedi is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 15, 2003
posts:7249
votes: 0


I can assure you not all applications are the same (luckily).

I agree with you entirely.

TJ

6:56 pm on Mar 1, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 23, 2004
posts:435
votes: 0


I was intrigued by the notion of capturing info about the display of the ads, and so I attempted to capture the google_* variable values (from the first <script> block). Only google_ad_width and google_ad_height return values after the second <script> block (the one pointing to show_ads.js) is called. Apparently google clears these on purpose. Any TOS violation with inserting a <script> block in between the two <script> blocks of google's? Is that considering "altering" the code (when no code is actually altered, only inserted in between their script blocks). If it would be a TOS violation, then manually copy/pasting the values into a seperate script block would be fine, I'm sure.
7:03 pm on Mar 1, 2004 (gmt 0)

New User

10+ Year Member

joined:Aug 15, 2003
posts:36
votes: 0


then manually copy/pasting the values into a seperate script block would be fine

You could always get the values from the iframe src (always accesible).

This 205 message thread spans 7 pages: 205