Monitor Adsense clicks with Google Spreadsheet

Starting from May 2013, Adsense has stopped showing invalid clicks in adsense reports.After this it became difficult to find out invalid clicks.Now, to identify the invalid clicks you can compare your Adsense clicks from Adsense report to another programs like StatCounter or Google Analytics.But these programs only provides limited logs. This script will check your Adsense earnings and store the data in a Google SpreadSheet after every minute.

What will this script  do?

I-It will log CPC of almost every click (Adsense Reports only shows average CPC).

II-You can find the number of invalid clicks and their timing.(Adsense Reports do not shows)

How to identify invalid clicks-

Every time a visitor clicks on an Adsense ads (CPC based) publisher’s account is credited for that click.But,if Adsense indentifies that click as Invalid  ,the click and earnings both are removed by Adsense from publisher’s account.This process usually takes 3 to 5 minutes but sometimes may take  longer time.This script runs after every minute so it will immediately log the click and earnings.Later,if adsense mark this click as Invalid then you will show the less number of clicks and earning.So check the spreadsheet if you see a deceasing number on click then it means click is marked as Invalid.Using this script you can also find the time of invalid click activity or any Click Bomb activity on your account.

Requirements-

1-An active Adsense account.

2.Google API key.

If you don’t have Google API key then follow these steps.

I-Go here and click on Services.

II-Turn ON to AdSense Management API.(Accept TOS)

III-Go to API access copy  API key under Simple API Access subheading.

API key

API key

 

Now follow these instruction to allow Google Apps Script to monitor and store your Adsense Data.

1-Go here and make a copy of this spreadsheet.

https://docs.google.com/spreadsheet/ccc?key=0AgS5G3JikVajdE9pcHFRMEgwZlRSWDNBMVUyRjhTUlE&usp=sharing

spreadsheet-make-a-copy

spreadsheet-make-a-copy

2.Go to Tools>Script Editor (a new window will open)

Open Script Editor

Open Script Editor

3.Assign your Adsense publisher id.

Adsense Publisher ID

Adsense Publisher ID

4.Click on Resources>Use Google APIs.

Use Google API

Use Google API

5.Turn on Adsense Management API and Enter your API key.

Enter API key

Enter API key

6-Click on Run and then click on Start.Google will ask to authorize the application ,click on Authorize and allow this application to access your Adsense data.

Run

Run

Now this script will store your Adsense logs in a Spreadsheet.To view the logs go to your Google Drive and open this SpreadSheet.

  • http://tamilcomputercollege.blogspot.com/ கணணிக்கல்லூரி

    Script has some errors. I’m getting “TypeError: Cannot read property “length” from undefined. (line 31, file “Code”)” error message on run generate report function.