Google have announced adsense for mobile so I decided to test it out on my ringtones WAP site which gets quite a lot of page impressions, 11 million in August though that includes the actual media files which obviously can’t have adsense on them. Went into my adsense account and created the mobile code to place on my wap site in my scripting language of PHP and WAP format of WML. Google gives you PHP code which sets a few global PHP variables and then tries to require the necessary code from the Google servers which is a bit of a problem as I disable PHP being able to fopen URLs for security reasons.
So I grabbed the code Google was trying to require and it seems like simple PHP that sends the request to the Google ad server through another fopen and echos the output. I changed the fopen code to a cURL request and just echoed that and it seems to work fine for the time being. But if Google ever change the code that I just downloaded there could be problems. I’m surprised they used fopen, if I was coding it I would have used a fsockopen function which is nearly guaranteed to always work no matter what settings the user has.
The only ads I’ve seen on it so far are for some kind of dating site. CPC is about the same as on the WWW site but CTR is fairly low, I’m guessing because the ads aren’t very targeted yet. Looks good for the future though. Google move first again.
Here’s the code I copied and pasted into my WML pages minus the publisher ID’s
$value) {
if ($param == "client") {
google_append_url($google_ad_url, $param,
"ca-mb-" . $GLOBALS["google"][$param]);
} else if (strpos($param, "color_") === 0) {
google_append_color($google_ad_url, $param);
} else if ((strpos($param, "host") === 0)
|| (strpos($param, "url") === 0)) {
google_append_url($google_ad_url, $param,
$google_scheme . $GLOBALS["google"][$param]);
} else {
google_append_globals($google_ad_url, $param);
}
}
google_append_url($google_ad_url, "dt",
round(1000 * array_sum(explode(" ", microtime()))));
return $google_ad_url;
}
$ch1 = curl_init(google_get_ad_url());
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
$google_blah = curl_exec($ch1);
echo $google_blah;
?>