Welcome to WebmasterWorld Guest from 54.145.44.134

Forum Moderators: incrediBILL & martinibuster

Message Too Old, No Replies

Quick AdSense Alt Ads Log Analysis Script

     

incrediBILL

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

WebmasterWorld Administrator incredibill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

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

WebmasterWorld Administrator incredibill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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.