google_ad_client Error
In this example, we automatically scan web pages and report if the google_ad_client field is in error.
On your web pages, if you display Google Adsense ads, in the Adsense JavaScript code you (or your content management system (CMS)) might mistakenly leave the google_ad_client field empty, or you might have entered the wrong client string. If that should happen to the all-important google_ad_client field, you would want to be alerted to that of course.
The ReportGoogleAdClientError script might send an alert message like the following:
PIKT ALERT
Thu Dec 8 06:38:49 2005
calgary
WARNING:
ReportGoogleAdClientError
Report if the google_ad_client field is in error
/var/www/html/pikt/todo.html: google_ad_client = "";
should be: "pub-8402291804739108"
[...]
The script follows.
#if piktwebsys
ReportGoogleAdClientError
init
status =piktstatus
level =piktlevel
task "Report if the google_ad_client field is in error"
input proc "=find =piktwebdir -name \\*.html -print
-exec =egrep google_ad_client {} \\;"
rule
if $inlin =~ "^=piktwebdir"
set $page = $inlin
next
endif
rule
if $inlin !~ "=googleadclient"
output mail "$page: $inlin"
output mail " should be: $dquote()=googleadclient$dquote()"
endif
#endif // piktwebsys
The =googleadclient macro might be specified in your macros.cfg file as follows:
googleadclient pub-8402291804739108
This is just one program example. You could write new scripts to: check the value of other fields in the Adsense JavaScript code; make sure that you have not violated the Adsense rules about total ad units (example); check to see if you have Adsense on the same page as some other conflicting ad program (example); check the validity of any Adsense section targeting tags (example); and so on.
For more examples, see Samples.