Publisher Stats API Integration

How to give your publisher access to the Swaarm search monetization stats using stats API

Updated over a week ago

Publisher Stats API

Publishers may want to integrate statistics into their internal systems, dashboards, or reporting tools, and API access allows them to design custom reports tailored to their specific needs.

If you have a Publisher who wants to retrieve the statistics using API, then you can provide them access to the Stats API. This can frequently be used in Search Monetization , where publishers seek to fetch statistics programmatically.


How to Access Publisher Stats API in Swaarm

  1. Go to the Publisher Details page

  2. Scroll down and find the API tab,

  3. Click on Stats API

  4. You can find the API Key, URL, and documentation

The following fields are available in the API:

  • adClicks: Unique users who clicked on an ad or sponsored links within SERP

  • clicks: Total number of clicks that have been redirected to the Advertiser

  • monetizedSearches: The overall number of searches where an ad or sponsored link is displayed on SERP (SERP)

  • feedId

  • payout: Publisher's revenue (TheyGet for us)

  • searches: Number of searches conducted by a user using various search terms

  • time: Timestamp at which the data is fetched

  • country: Country information for the respective stats

Stats API Request

The request can be made to https://INSERT_DOMAIN_HERE/publishers/search using the GET method.

Parameters

The following parameters can be added to the query string:

  • token - Feed API token (i.e. API key from)

  • from - From where you want to load the stats

    • from=YYYY-MM-DDTHH:MM:SS 2023-12-01T00:00:00

  • to - Till when you want to load the stats

    • to=YYYY-MM-DDTHH:MM:SS 2023-12-14T00:00:00

  • granularity - If you want to split the data daily or hourly

    • Can be between DAY / HOUR

  • withFeed - If this option is set to true, we will split by feed ID as well

    • Values can be between true or false

  • withSubId - If this option is set to true, we will split the stats by subID as well

    • Values can be between true or false

Example Request

The following request retrieves the data for one publisher from the 1st of December to the 14th of December:

https://api.buster.swaarm-clients.com/publishers/search?token=7d92ca59-8e53-4447-8e2e-3c06cd95ce7f&from=2023-12-01T00:00:00&to=2023-12-14T00:00:00&granularity=DAY&withFeed=true

Example Response

{
"reports": [
{
"adClicks": 0,
"clicks": 7,
"monetizedSearches": 0,
"feedId": null,
"payout": 0.0,
"searches": 7,
"time": "2023-12-05T00:00:00"
},
{
"adClicks": 161,
"clicks": 2004,
"monetizedSearches": 0,
"feedId": null,
"payout": 57.64,
"searches": 2004,
"time": "2023-12-07T00:00:00"
},
{
"adClicks": 0,
"clicks": 4357,
"monetizedSearches": 0,
"feedId": null,
"payout": 0.0,
"searches": 4357,
"time": "2023-12-08T00:00:00"
},
{
"adClicks": 0,
"clicks": 4464,
"monetizedSearches": 0,
"feedId": null,
"payout": 0.0,
"searches": 4464,
"time": "2023-12-09T00:00:00"
}
]
}

Did this answer your question?