Archive for November, 2008
November 9, 2008 by Alex Polski | 2 Comments »
There is a nice PHP class for the retrieving the data from Google Adsense account like impressions, clicks, ctr, ecpm and earnings - PHP account adsense monitor. But it does not work now, seems Google updated the authorization system for Adsense. I’ve fixed it a bit and now you can use it in your web applications.
A small example:
<?php
include('adsense.php');
$adsense = new AdSense();
if ($adsense->connect('username', 'password'))
{
$data = $adsense->yesterday();
var_dump($data);
}
else
{
die('Could not login to AdSense account!');
}
?>
This code will output something like this:
array(5) {
["impressions"]=>
string(2) "49"
["clicks"]=>
string(1) "0"
["ctr"]=>
string(5) "0.00%"
["ecpm"]=>
string(5) "$0.00"
["earnings"]=>
string(5) "$0.00"
}
You can download the script here.
Alex Polski’s Blog is proudly powered by WordPress | Entries (RSS) and Comments (RSS). | Copyright(c) 2008 by Alex Polski