homepage Welcome to WebmasterWorld Guest from 54.198.130.203
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Google / Google AdSense
Forum Library, Charter, Moderators: incrediBILL & jatar k & martinibuster

Google AdSense Forum

    
Quick AdSense Alt Ads Log Analysis Script
incrediBILL




msg:4254917
 12:33 am on Jan 19, 2011 (gmt 0)

This works on Linux Apache access_logs and may work on Windows logs with a couple of tweaks, assuming you have awk, grep, sort and uniq installed.

The following single command line extracts all occurrences of the google_adsense_alt_ads.html, filters out just the referral page, sorts them in alpha order, then counts the # of occurrences and displays the results.

grep "google_adsense_alt_ads.html" -i access_log | awk '{print $11}' | sort | uniq -c

grep finds all the occurrences of the .html file in access_log then pipes it using the "|" character to awk, which then outputs just the HTTP referrer (field #11) from the Apache log entry, which is then piped to sort which outputs the file in alpa order to uniq, which counts and removes the duplicates.

The resulting output looks like this:

1 "apage.html"
3 "bpage.html"
1 "cpage.html"
6 "dpage.html"

etc.

If you only see "1", it means there was just a single occurrence, 1 ad unit didn't display, happens, I wouldn't worry.

If you see a big # for lots of occurrences, I'd check the page and see if the ads have stopped running.

 

incrediBILL




msg:4255330
 7:22 pm on Jan 19, 2011 (gmt 0)

Whoops!

I was wrong, if you use a single page like "google_adsense_alt_ads.html" the browser caches it so even a single occurrence in the log file can mean NO ADS RUNNING.

To solve this problem, make a unique page per ad block such as:
google_adsense_alt_ads_skyscraper.html
google_adsense_alt_ads_linkunits.html
google_adsense_alt_ads_bigbox.html

etc.

Then change the command above to be:

grep "google_adsense_alt_ads_" -i access_log | awk '{print $11}' | sort | uniq -c

Leaving it open ended will catch all the variations.

This way you can easily see which individual units didn't display, or all.

Just when you think you have it under control you find something overlooked :)

Can't wait to share the story that started this after I'm sure it's fixed.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Google / Google AdSense
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved