API Global Routes Function Masterclass #1: Advertisers
In the first of this series of two blog posts, we will show you how to fetch data from our platform by using the new API Global routes function. The aim is to help you to analyse and multi-filter some selected statistics utilising examples from this spreadsheet which should copy to your Google Drive. The spreadsheet will get you started using the API with some examples and then later, when you feel more confident you can start creating your own examples and tasks.
Use the spreadsheet to help you fetch the data. All of the API coding is done using Google script language, so when you open the spreadsheet simply go to the ‘Tools’ menu and select ‘Script Editor.’ See the two screenshots below:
Fig 1. Script editor access
Fig 2. Script code – Texts in brown explain what each part of the code does.
So, in the first part of this series, we will show you how to fetch data by using a multi-filtering example. This will allow you to filter the total amount of impressions by date, campaign ID, zone ID, country, language or browser. The purpose is to help you see in detail how the traffic is distributed and performing for your campaigns according to your results.
In order to use ExoClick’s API you must set a Session Token. To set a token, you must have a valid account with the required username and password. The API Token creation is available under your My Profile menu. Select API Tokens
Copy the spreadsheet to your personal Google Drive and open the sheet. Here you will see that you can fetch a campaign’s data for impressions and cost: filtered by date, zone Id, country, language or browser.
Add the CID in the campaign field. This will allow the system to identify which campaign you want to request and pull the data from.
Then, set the date parameters by adding them into the date fields (Date from, Date to). This will establish the period from which you wish to request the data.
Now you can set the filters from the Multi Selector which are loaded from “getCountries, getLanguages, getBrowsers” sheets. If those sheets are blank simply paste in your API token, hit the Generate Data button and the information will be pulled and added to the sheet. See the three sheets below as in our example:
You can carry out multi-selection by adding multiple elements to your selector. To do this simply select the field where the selector is, go the top menu and click on “Scripts > Multi-select for this cell…” A new view will appear in the right side of the screen allowing you to select multiple options. Then click “Select”.
Once all your options have been set, simply click on the Generate Data button on the spreadsheet and the data will be displayed.
Note: All the data statistics are based in Eastern Time (EST – New York)
Do you have an idea for this Data Collection example that could be used for another type of filtering? Why not email us at firstname.lastname@example.org. Please put as the subject email title: API Ideas.