14.1.06

Track AdSense Clicks With Google Analytics

Verteiler: [Ho,Og,My,Pn,Jt,Sz]

Track AdSense Clicks With Google Analytics

<!--google_ad_client = "pub-5676236325709660";google_ad_width = 125;google_ad_height = 125;google_ad_format = "125x125_as";google_ad_type = "text_image";google_ad_channel ="6594988334";google_color_border = "FFD165";google_color_bg = "FFFFFF";google_color_link = "336699";google_color_url = "000000";google_color_text = "000000";//-->
It would be cool if Google automatically tracked AdSenseclicks into Google Analytics... But until they do, here's a little bitof JavaScript code you can use to do it. You can then setup an AdSenseclick as a "goal" within the Analytics interface.
<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>
This only works with Internet Explorer because of some limitations/bugwith Mozilla. I'm too lazy to code a complicated workaround for otherbrowsers (which would involve running JavaScript code whenever themouse moves which seems really inefficient to me). Hopefully Mozillawill fix the bug (although it's been pending for 2 1/2 years now).

Basically it will log an AdSense click as a pageview to a non-existent page ( http://www.digitalpoint.com/AdSenseClick in my case).

Update I made a version of the code that will work with AdSense and/or Yahoo Publisher Network. You can find it over here .

Read more at www.digitalpoint.com/%7...

Keine Kommentare: