tracking adsense with analytics

Discussion in 'Reporting & Stats' started by fsmedia, Jan 19, 2006.

  1. #1
    I looked around, but couldn't find a thread on this already. But Shawn created this script to track clicks here: http://www.digitalpoint.com/~shawn/2005/11/track-adsense-clicks-with-google-analytics.html -- but I can't figure out what to use as the target URL for the goal so it will track properly. Anyone know what the end URL is supposed to be?

    Oh wait, after re-reading the code I figured it out. Set the goal to where the urchin is pointing at. *slaps forehead...duh*
     
    fsmedia, Jan 19, 2006 IP
  2. fsmedia

    fsmedia Prominent Member

    Messages:
    5,163
    Likes Received:
    262
    Best Answers:
    0
    Trophy Points:
    390
    #2
    I tried it and it updates, but it didn't track it properly. It also doesn't display the whole code in the site, only part of it. but when I view the source on the server, it shows it -- but not on the screen. any ideas what I might be doing wrong?
     
    fsmedia, Jan 20, 2006 IP
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    What "whole code"? I'm lost...
     
    digitalpoint, Jan 20, 2006 IP
  4. fsmedia

    fsmedia Prominent Member

    Messages:
    5,163
    Likes Received:
    262
    Best Answers:
    0
    Trophy Points:
    390
    #4
    the code it shows to add:

    <script type="text/javascript">
    // by Shawn - http://www.digitalpoint.com/~shawn/2005/11/track-adsense-clicks-with-google-analytics.html
    // Put this at the bottom of the page (after the last AdSense block)
    	
    function adsense_click() {
    	if(window.status.indexOf('go to') == 0) {
    		urchinTracker ('/AdSenseClick');
    	}
    }
    	
    var elements;
    if(document.getElementsByTagName) {
    	elements = document.body.getElementsByTagName("IFRAME");
    } else if (document.body.all) {
    	elements = document.body.all.tags("IFRAME");
    } else {
    	elements = Array();
    }
    	
    for(var i = 0; i < elements.length; i++) {
    	if(elements[i].src.indexOf('googlesyndication.com') > -1) {
    		elements[i].onfocus = adsense_click;
    	}
    }
    </script>
    Code (markup):
    It turns up like this:
    <script type="text/javascript">
    // by Shawn - http://www.digitalpoint.com/~shawn/2005/11/track-adsense-clicks-with-google-analytics.html
    // Put this at the bottom of the page (after the last AdSense block)
    	
    function adsense_click() 
    }
    	
    var elements;
    if(document.getElementsByTagName)  else if (document.body.all)  else 
    	
    for(var i = 0; i < elements.length; i++) 
    }
    </script>
    Code (markup):
    So it looks like it'smissing something -- where did I go wrong?
     
    fsmedia, Jan 20, 2006 IP
  5. fsmedia

    fsmedia Prominent Member

    Messages:
    5,163
    Likes Received:
    262
    Best Answers:
    0
    Trophy Points:
    390
    #5
    Shawn -- any idea how to get this working? It's still not functioning properly for me...
     
    fsmedia, Jan 22, 2006 IP