I found an adsense tracker script that was sort of incompatible and modified it to work nice, however i am not sure if it will work good. I tested it and it didn't seem to register into DB. And also i am wondering if there are any hidden disadvantages to this, or a possiblity of getting banned or anything. If it will work fine, or something you are free to use it. Hope it helps. (However you do need a tracker.php which you yourself must design in order to add the info to database) heres teh script: <script> var thetitle = "<?php echo $_SERVER['REQUEST_URI']; ?>"; var ip = "<?php echo $_SERVER['REMOTE_ADDR']; ?>"; // Just defining some PHP variables like the IP. </script> <script language="javascript" type="text/javascript"> var IE, Gecko, Safari, Konqueror; // Modified by DesignPlanet.biz var agent = navigator.userAgent.toLowerCase(); IEx = ((agent.indexOf("msie") != -1) && (agent.indexOf("opera") == -1) && (agent.indexOf("webtv") == -1)); Geckox = (agent.indexOf("gecko") != -1); Safarix = (agent.indexOf("safari") != -1); Konquerorx = (agent.indexOf("konqueror") != -1); var iFr; function AdSenseLog(){ var theAd = "" + escape(window.status.substring(6)) ; var format = queryString('format', iFr.src); var channel = queryString('channel', iFr.src); var bug = new Image(); bug.src = 'tracker.php?ref=' + document.referrer + '&url=' + theAd + '&title=' + thetitle + '&format=' + format + '&channel=' + channel + '&ip=' + ip; } function queryString(item, source){ var itemLoc = source.indexOf(item); var newSrc = source.substring(itemLoc); var endLoc = newSrc.indexOf("&"); var lstSrc = newSrc.substring(0, endLoc); var itm = lstSrc.substring(item.length+1); return itm; } var elements; element = document.getElementsByTagName("iframe"); for (var i = 0; i < element.length; i++) { if(element.src.indexOf('googlesyndication.com') > -1){ if(IEx){ element.attachEvent("onfocus", AdSenseLog); } else { element.onfocus = AdSenseLog; } iFr = element; } } </script>
Check this page: http://www.digitalpoint.com/~shawn/2005/11/track-adsense-clicks-with-google-analytics.html Its a code compiled by Shawn to track adsense clicks within Google Analytics.
I dont like google analytics... i find logging into it a hassle I have a better stat maker already. Is there a way i can track it and add it to a database. Will my code work?
execute if you dont mind. You can please let us know which tracker you use. Cause what i believe is that Analytics is the good and shows good tracking.