Articles on: Developers

Polaris Reporting API

Endpoints



The Polaris Reporting API can be reached at:

https://inc-metrics.prod.api.metric.works

The endpoints are:

https://inc-metrics.prod.api.metric.works/token - Obtain security token for authentication
https://inc-metrics.prod.api.metric.works/query - Submit a query to obtain reporting data


Limits



The API has the following limits:

LimitValue
Request Rate60 requests per minute per account
Concurrent Requests1
Date RangeMax 30 days per request
App Filter1 app per request (use the full App Name in Polaris as the filter value)



Authentication



All requests to the Reporting API's query endpoint must specify a security token obtained from the token endpoint. To obtain a security token, POST a request containing the following JSON body:

{ "username": "my.email@company.com", "password": "mypassword" }


Replace the username and password placeholder values above (my.email@company.com and mypassword) with your actual Polaris username (which is your email address) and password.

If successful, the response will be a text security token that must be specified in your query requests as a Bearer token in the Authorization header like the following:

Authorization: Bearer [security token]


Replace the [security token] placeholder in the header example above with the security token. Security tokens are valid for 1 hour from the time they are obtained from the token endpoint. Specifying an expired security token will result in a 401 Unauthorized response from the query endpoint.


Querying



To query reporting data from the Reporting API, POST a request containing one or more of the following properties:

Property NameDescriptionExampleMandatory
startDateThe desired start date of the results. Format: yyyy-mm-dd.
2021-01-01
Yes
endDateThe desired end date of the results. Format: yyyy-mm-dd.
2021-01-31
Yes
groupByAn array that represents the dimensions that the results should be grouped by. See Group By.
["CHANNEL", "COUNTRY"]
Yes
metricsAn array that represents the metrics that should be returned. See Metrics.ExampleYes
filtersAn array that represents the values that results should be filtered on. See Filters.ExampleNo
orderByAn array that represents the dimensions that the results should be ordered by. See Order By.ExampleNo



Group By



The table below describes the dimensions that can be used as valid values in the groupBy property. The group by can be thought of as the granularity of the returned results.

ValueDescription
DATEDate
PLATFORMPlatform
APPApp
CHANNELChannel
CAMPAIGN_GROUPCampaign
COUNTRYCountry
SITESite



Metrics



Each metric object listed in the metrics property must specify the following properties.

Property NameDescriptionExampleMandatory
typeThe type of the metric. See the table below for valid values.
COHORT_REVENUE
Yes
dayThe cohort day of the metric. Only required when the metric is a cohorted metric.
7
No
intervalWhether or not the 95% confidence interval should also be returned. Only applicable when the metric is an incrementality metric.
true
No


The table below describes the metric types that can be used as valid values in the type property of the each metric object. Metric types prefixed by INC_ are incrementality metrics; others are last touch.

ValueDescriptionCohorted
SPENDSpendNo
NEW_USERSInstalls or registrationsNo
INC_NEW_USERSIncrementality installs or registrationsNo
COHORT_SIZECohort sizeYes
INC_COHORT_SIZEIncrementality cohort sizeYes
RETAINED_USERSRetained usersYes
INC_RETAINED_USERSIncrementality retained usersYes
COHORT_REVENUECohorted total revenueYes
INC_COHORT_REVENUEIncrementality cohorted total revenueYes
COHORT_AD_REVENUECohorted ad revenueYes
INC_COHORT_AD_REVENUEIncrementality cohorted ad revenueYes
COHORT_IAP_REVENUECohorted purchase revenueYes
INC_COHORT_IAP_REVENUEIncrementality cohorted purchase revenueYes
RETENTION_RATERetention rateYes
INC_RETENTION_RATEIncrementality retention rateYes
COST_PER_NEW_USERCPI or cost per acquisitionNo
INC_COST_PER_NEW_USERIncrementality CPI or cost per acquisitionNo
ROASReturn on ad spendYes
INC_ROASIncrementality return on ad spendYes
LTVLifetime value or average revenue per user (ARPU)Yes
INC_LTVIncrementality lifetime value or average revenue per user (ARPU)Yes
COHORT_PURCHASESCohorted number of purchases or subscriptionsYes
INC_COHORT_PURCHASESIncrementality cohorted number of purchases or subscriptionsYes
COHORT_SESSIONSCohorted sessionsYes
INC_COHORT_SESSIONSIncrementality cohorted sessionsYes
COHORT_PAYING_USERSCohorted number of unique users with at least one purchaseYes
INC_COHORT_PAYING_USERSIncrementality cohorted number of unique users with at least one purchaseYes
COHORT_PAYING_RATECohorted % of users that made at least 1 purchaseYes
INC_COHORT_PAYING_RATEIncrementality cohorted % of users that made at least 1 purchaseYes


Metrics Example


[
  {
    "type": "INC_NEW_USERS",
    "interval": true
  },
  {
    "type": "NEW_USERS"
  },
  {
    "type": "INC_ROAS",
    "day": 3,
    "interval": false
  },
  {
    "type": "ROAS",
    "day": 3
  }
]



Filters



Each filter object listed in the filters property must specify the following properties.

Property NameDescriptionExampleMandatory
typeThe dimension of the filter using any value valid as a group by.
CHANNEL
Yes
valuesAn array that represents the values that you wish to filter the dimension on.
["Facebook"]
Yes
notWhether or not the filter should be negated.
false
No


Filters Example



[
  {
    "type": "CHANNEL",
    "values": ["Facebook"],
    "not": false
  }
]



Order By



Each order by object listed in the orderBy property must specify the following properties.

Property NameDescriptionExampleMandatory
typeThe dimension of the order by using any value valid as a group by.
CHANNEL
Yes
descendingWhether or not you wish to order descending rather than the default ascending.
false
No


Order By Example



[
  {
    "type": "CHANNEL",
    "descending": false
  }
]



Code Sample



The following is a code sample written in Python. It implements no fault tolerance, error handling, or throttling, but should provide an idea of the basics.

import requests

token_endpoint = "https://inc-metrics.prod.api.metric.works/token"
query_endpoint = "https://inc-metrics.prod.api.metric.works/query"

username = "username"
password = "password"

credentials = {
    "username": username,
    "password": password
}

query = {
    "groupBy": [
        "CHANNEL"
    ],
    "metrics": [
        {
            "type": "INC_NEW_USERS",
            "interval": True
        }
    ],
    "filters": [
        {
            "type": "APP",
            "values": ["App Name (iOS)"]
        }
    ],
    "order": [],
    "startDate": "2022-06-01",
    "endDate": "2022-06-01"
}

token_response = requests.request("POST", token_endpoint, json=credentials)

headers = {'Authorization': 'Bearer ' + token_response.text}

query_response = requests.request("POST", query_endpoint, headers=headers, json=query)

print(query_response.text)

Updated on: 02/03/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!