
So today i decided to utilise my adsense account which i've had since 2004. I can't remember the last time I actually used it, but it hasn't been active for quite awhile.
Anyway, I've put some ad code here and there and I thought to myself, wouldn't it be great if I could detect when someone clicked on an ad and do some simple logging. Now I know adsense allows you to gather certain information using channels, but i wanted to do my own tracking.
So the following is what I came up with:
Basically the script runs the function adsense when the window/page loads. This fuction scans through your page and attaches an 'onfocus' event to your google Adsense ads. All google adsense ads are in iframes (generated by the javascript you include in you pages). So, every time someone gives focus to an advert, the AdSenseLog function is called.
I haven't included the code i'm using for logging as i'm still working on it, but there is no reason why you couldn't utilise ajax to call some server side script/functions to do some logging.
You'll also notice that I've created my own function called AttachEvent. This is because IE doesn't support. The DOM friendly 'addEventListener' like Mozilla/FireFox does. IE uses its own event managment called 'attachEvent' (lower case 'a'). Therefore I needed a simple cross-browser solution as above, which i've called 'AttachEvent' (uppercase 'A').
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
JAYESH TALSANIYA said: in mssql u cannot use parentheses in select statement. use as below: INSERT INTO [TABLE] (column1,... [More]
Multiple SQL inserts: Oracle, Mysql, MssqlJD said: I found with MSSQL, I couldn't use parentheses in my select statements for insert. So, from your ex... [More]
BlogCFC ping list and timeoutsWill Wilson said: Nice :) that will come in handy, thanks! [More]
Is this a Coldfusion 8 BUGBarb said: I'm having the same problem . . . when I start CF8, it seems to hang during or just after the user M... [More]
Is this a Coldfusion 8 BUGJoão Fernandes said: Phil, when you install CF8 they give you an option to install LCDS within CF. The messageBrokerServl... [More]
There are no comments for this entry.
[Add Comment]