
You have to create a new channel in your Adsense setup first and name it "Google"or maybe "Google Search" or whatever pleases you. Then, the type of ad must be having the same preferences as one of your already existing ad types on your site, you just have to change the channel.
Then, include this code to the top of the page where you want to track Google users from.
<?php if (stristr(getenv('HTTP_REFERER'),"google"))
setcookie("Referer", "Google"); ?>
This code sends a cookie to the user's browser to identify the user as Google search referer.
Now, edit your existing ad code. Note the google_ad_channel variable. Copy the google_ad_channel value from the new ad type with Google channel, and paste it here instead of XXXXXXXXXX.
google_ad_channel = "<?php if ($_COOKIE[Referer]=="Google") echo 'XXXXXXXXXX'; else echo 'YYYYYYYYYY'; ?>";
X - new Google google_ad_channel id
Y - old google_ad_channel id
This way you can have a separate channel just for Google refered visitors, and count impressions, clicks and eCPM just for those guys who came to your site searching the web by Google.
via ByteInsider






Comment Preview