How to use Multi-filtering with ExoClick’s API Global Routes

ExoClick has updated its platform API with some new features that allow you to automate statistics to be multi-filtered and cross-referencing of data. In this blog post we will give you an overview of the new features and code examples for Advertisers and Publishers to automate multi-filtering of some selected statistics.

Here is an outline of the new API features:

Flexibility:

The new global routes provide you with much more flexibility than the normal static routes on how you can query data. You can now mix and match the dimensions you wish to query, filter and group by.

See: https://api.exoclick.com/v2/manual/global-statistics-api/#parameter-filter

 

Grouping:

Grouping now allows you to group with more than one dimension (* maximum of two).

See: https://api.exoclick.com/v2/manual/global-statistics-api/#parameter-group-by

 

Ordering:

Ordering now allows you to pull out the data by a dimension in ascending or descending mode.

 

Projections:

The projection feature allows you to control what specific data is returned in the response, for example, if you do not require RTB data you can exclude this in the returned payload by projecting what you actually need. This defaults to all.

See: https://api.exoclick.com/v2/manual/global-statistics-api/#parameter-projection

 

Detailed:

The detailed flag is not a new feature per se as this is already available in some existing routes.
Again this gives you the power to control what data is returned in the response either as a summary or extended data.

See: https://api.exoclick.com/v2/manual/global-statistics-api/#parameter-detailed

 

Advertiser multi-filtering example

Complete Body Request: https://api.exoclick.com/v2/docs/#!/47statistics/post_statistics_advertiser_global

{
  "count": 0, "detailed": 0, "timezone": "Europe/Dublin", "totals": 1, 
    "filter": {
        "exclude_deleted": 0, "browser_id": [12345], "campaign_calculated_status": 
        [12345], "campaign_id": [12345], "campaign_group_id": [12345], 
        "carrier_id": [12345], "category_id": [12345], "country_iso": ["USA"], 
        "date_from": "2019-01-01", "date_to": "2019-01-14", "device_id": [12345],
        "hour": [1,2], "language_id": [12345], "offer_id": [12345], 
        "offer_landing_page_id": [12345], "operating_system_id": [12345],    
        "region_id": [12345], "site_hostname": ["www.example.com"],
        "site_id": [12345], "variation_id": [12345], "zone_id": [12345]
        },
    "group_by": ["date"],
    "order_by": [{"field": "impressions", "order": "desc"}],
    "projection": ["video"], 
    "limit": 25,
    "offset": 0
}

Example:

In this example we are making a request where we are filtering by campaignId, country, language, browser and zoneId and then grouping the results by date and zoneId and ordering by impressions descending for a specific time period:

Example of body request code:

{
  "count": 0, "detailed": 1, "timezone": "Europe/Dublin", "totals": 1,
  "filter": {
    "browser_id": [2], "campaign_id": [123456], "country_iso": ["USA"], "date_from": 
"2019-04-15", "date_to": "2019-04-30", "language_id": [149], "zone_id": [7891011]
  },
  "group_by": ["date", "zone_id"],
  "order_by": [{"field": "impressions", "order": "desc"}],
  "projection": ["video"],
  "limit": 25,
  "offset": 0
}

Result:

 

Publisher multi-filtering example

Complete Body Request: https://api.exoclick.com/v2/docs/#!/47statistics/post_statistics_publisher_global

{
  "count": 0, "detailed": 0, "timezone": "Europe/Dublin", "totals": 1,
  "filter": {
    "adblock": "standard", "browser_id": [12345], "category_id": [12345],
    "carrier_id": [12345], "country_iso": ["USA"], "device_id": [12345],
    "date_from": "2019-01-01", "date_to": "2019-01-14", "hour": [1, 2],
    "language_id": [12345], "operating_system_id": [12345],
    "region_id": [12345], "site_id": [12345], "sub": [12345], "zone_id": [12345]
  },
  "group_by": ["date"], "order_by": [{"field": "impressions", "order": "desc"}],
  "projection": ["video"],
  "limit": 25,
  "offset": 0
}

Example:

In this example, we are making a request where we are filtering by zoneId, country, language, browser, and deviceId and grouping the results by date and order by impressions descending for a specific time period:

Ex Body request:

{
  "count": 0, "detailed": 1, "timezone": "Europe/Dublin", "totals": 1,
  "filter": {
    "adblock": "standard", "browser_id": [2], "category_id": [],
    "carrier_id": [], "country_iso": ["USA"], "device_id": [43],
    "date_from": "2019-04-15", "date_to": "2019-04-30", "hour": [],
    "language_id": [149], "operating_system_id": [11],
    "region_id": [], "site_id": [], "sub": [], "zone_id": [3340006]
  },
  "group_by": ["date"], "order_by": [{"field": "impressions", "order": "desc"}],
  "projection": ["video"],
  "limit": 25,
  "offset": 0
}

Result:

 

We hope that you find these examples useful to get you started on trying out the new API features.

Click here for more general information about our API for additional reading

 

More blog posts about the API:

How to use ExoClick’s Platform API v2

API Masterclass #1: Data Collection

API Masterclass #2: Zone Optimization

API Masterclass #3: Campaign Performance

 

 

Juanma Cortes