▪️Reporting API
This document describes API to get affiliation metrics (commission, balance, registrations, etc.).
It can be used by the Operator - to get metrics for all affiliates
Or it can be used by the Affiliate - to get only their own metrics
The Smartico Affiliation module provides API to retrieve configurational, operational, and analytical data. API is provided as a REST over HTTP and uses SSL for data protection.
Affiliates can use API to get reports related to the activities of their own traffic and for the Operator to have access to all affiliates' data.
API for the Affiliate
Accessing analytical data
The Affiliation system has an API endpoint that provides statistical information about visits, registrations, commissions, etc., aggregated by a specified period or for a lifetime.
Example of the API call using CURL:
Example of API call using NodeJs:
Parameters in API call:
As aggregation_period you can pass DAY, MONTH, YEAR, or keep it empty in order to get aggregate data for the lifetime.
Optional parameter group_by could have a comma-separated list of the fields to group results. Possible values are:
utm_campaign
utm_medium
utm_source
afp, afp1, afp2.... afp9
link_id
brand_id
campaign_id
source_id
deal_root_original_id
registration_id (requires "Registrations report" permissions)
ext_customer_id (requires "Registrations report" permissions)
username (requires "Registrations report" permissions)
Optional parameters date_from and date_to could be used to limit results for the defined period. The format of the date is YYYY-MM-DD
Important note regarding setting date_from and date_to parameters.
date_from is inclusive
date_to is exclusive
This means that for the request with date_from = 2022-07-12 and date_to=2022-07-14, API will return data for 12 and 13 July only.
Example of response:
Here is the visual presentation of the same response in the reporting UI of the affiliation system:
API for the Operator
Accessing analytical data
Operator API is similar to the Affiliate API.
Example of the API call using CURL:
The difference between APIs:
. | Affiliate API | Operator API |
---|---|---|
Method name | af2_media_report_af | af2_media_report_op |
Possible values for group_by parameter | afp(1..9), utm_campaign, utm_medium', utm_source, link_id, brand_id, source_id, campaign_id, registration_id, ext_customer_id, username | affiliate_id, registration_id, ext_customer_id, username, afp(1..9), utm_campaign, utm_medium', utm_source, link_id, brand_id, campaign_id, source_id, deal_root_original_id, child_affiliate_id |
Possible values for filtering data | date_from, date_to | date_from, date_to, affiliate_id |
Important to know
all amounts are in operator currency
As Smartico is providing an affiliation system as a white-label solution, you can find the name, domain, and image of the “Operator” operating affiliation system in response to API calls.
In grouping by "day", the report will show the change of commission during this day. It's not a total commission at the end of the day.
If you are querying aggregated data and there are no activities for a specific period, the record for a specific period will be missing in response to not all of the attributes being available for every affiliate. It depends on the permissions that were given to the Affiliate regarding what he can see
If you query for aggregated data, the response will show only changes for a specified period. Given the example in the image below, you should treat it in the following way:
During July, the affiliate had a change of balance “-795.50 EUR”, and because it was his first month, at the end of the month, his balance will be -795.50 EUR
During August, he had a positive change, +225 EUR. This means that his balance was “-570.50 EUR at the end of August.”
Last updated