There is now an easy way to see the current revenues from Google Adsense in your Geckoboard dashboard – in realtime (only depending on the update frequency of Google Adsense).
Adding a Google Adsense dashboard is easy. All you need is a website that can run a PHP script and also has the CURL module installed.
You only need to download the following archive and extract it to a directory on your webserver. It is not necessary to protect the directory with a .htaccess file because Geckoboard provides an internal mechanism therefor which is implemented in the Adsense widget.
Step1: setup widget configuration
You first need to configure the widget itself. Thus you need to edit config.inc.php. The following values are used at the moment:
- $login: use your login email address to access your Google Adsense account
- $password: write here your password to login with the specified account
- $sharedSecrect: this is used to authenticate the request sent by Geckoboard so that only some knowing the secret can access the script and so see your Adsense revenue
- $value1: specifies what shall be displayed as the main value, consists of the following elements:
- report: defines which Adsense build-in report should be displayed, can be today, yesterday, last7days, lastmonth, thismonth, sincelastpayment
- display: defines which value of the selected report is to be displayed; can be: impressions, clicks, ctr, ecpm, earnings
- text: optional, can be used to display additional information text (only used for bigger widget sizes)
- $currency: optional, can be used as a prefix string before the value; e.g. ‘$’, ‘€’, ‘£’ or another simple string like ‘CHF’.
Step 2: Geckoboard
Setup a new instance in Geckoboard. Log in to www.geckoboard.com and go to your dashboard.
Press Add Widget and Select Custom Widgets => Number and Secondary Stat
Configure the new widget instance with the following values
- URL data feed: the url where you stored the widget, e.g. www.yourdomain./mygbwidget/widget.php
- API key (optional): the shared secret you specified in step one for $sharedSecret
- Widget type: Custom
- Feed format: JSON
- Request format: GET
- Reload time: 15 (min)
- Label (optional): whatever you like
- Select widget size: small should be fine
That’s it, now you will see your Adsense stats:
Limitation and known problems
- It takes some times until Google finally delivers the data to the widget.
- The library to fetch the Google Adsense data is using the old Adsense interface.
References and used libraries
- php-adsense-account-library – to access Google Adsense, updated with the fixes provided by the user in the forum.