Forum Moderators: martinibuster
Can a script be written that will intercept all clicks on a page (or in a section of a page, e.g. <DIV>), perform any operation (e.g. execute a server CGI that would log the click) and then pass it to be processed normally? This script would have to execute before the Adsense script gets run.
If this is possible, this would be a way to track clicks without breaking the TOS. If not, sorry for my wild imagination.
the onlick handler could than source a webbug that could log the page title (or other data).
I wrote a little script to do something like this. My laziness combined with promises of "working on reporting by domain" combined with fear of being booted, however, prevented me from implementing it.
you can use javascript to add an onclick handler to all of the iFrames on a page.
This sounds promising. Would you be willing to post your little script (even if it is incomplete)?
If google names their iFrame, would you be able to add the handler only to that particular frame?
... combined with fear of being booted
I didn't think this would be violation of the TOS (since it only says you cannot modify the script provided by Google), although it does seem like a violation of the spirit of the TOS.
It is kind of a gray area ... I wonder what GoogleAdvisor would say?
Here's my little test page.
<head>
<title>here is the page title</title>
</head>
<script>
function log() {
alert(document.activeElement.name);
alert(document.title)
}
</script><script>
function attach() {
x = document.getElementsByTagName("iframe")
for(i=0;i<x.length;i++) {
x[i].attachEvent("onfocus",log)
}
}
</script>
<br><br>
<iframe name="ifr" width=300 height=200 src=iframe_content.html></iframe>
<br>
<a href="#" width=300 height=200 onclick="javascript:attach()">Attach Event</a>
Notes
1. For testing the event handler is added with a link. In practice, you would want to use an onLoad handler in the body tag, or put it in the bottom of the page.
2. Also, for testing you will need some file to supply the content of the iFrame (iframe_content.html)
3. I tried attaching the onClick handler which doesn't work for some reason. onFocus seems to do the job.
4. The JavaScript function log, just alerts you that the iframe received focused (i.e was clicked). In actual practice, you would want to use a webbug to log the event.
5. I have no idea as to browser compatability. Heck I'm just a marketer.