API
- Reports on campaigns, lands, offers, sources
- Campaigns report
- Update costs
- Add, change, delete and restore list of offers and landings
Often you need to get data from your tracker for additional scripts, services, automation. For this we implemented API that displays any data from tracker in a convenient JSON format. Functions for processing this format are in any common programming language.
Working with API in our tracker is simple. First go to the Settings (top menu on the right). At the bottom of the page find API and copy the &api_key=XXXXXXXXXXXXX
parameter.
Then go to any report (for campaigns or landas), add this parameter to the URL and load this URL. You will see all the same data as in the report, but in JSON format.
Reports for campaigns, lands, offers and sources
For example, we need to get information about our campaigns. Let’s open Campaigns page and display the Test group's campaigns with traffic for last 7 days.
Then add to the URL our api_key - &api_key=1000001a768088356b266709102e84d50bcf4c6
and will see following data:
[{
"id":"10",
"status":"1",
"name":"Test Camp",
"date_cr":"1458474310",
"keyword":"676zlthzbiagiyetab8v",
"group_id":"2",
"group_name":"Test",
"ts":"Test",
"ts_id":"2",
"start_date":"1458470766",
"clicks":"2038",
"bots":0,
"profit":"-11.28000",
"ROI":"-55.348380765",
"LP_CTR":"0.0000",
"leads":"92",
"CR":"4.5142",
"EPC":"0.004465161",
"CPC":"0.010000000",
"rev":"9.10000",
"spend":"20.38000",
"lp_cl":"0",
"off_cl":0,
"note":0,
"current_cpc":"0.01000",
"auto_cpc":0,
"link":"http:\/\/\/tracker.com\/click.php?camp_id=10&key=676zlthzbiagiyetab8v&creative={creative}"
}]
In general, most of the parameters have clear meaning. But, just in case, we will analyze them all.
Parameter | Description |
---|---|
id | Campaign id |
status | Сampaign status: 1 - active, 0 - in the archive (deleted) |
name | Campaign name |
date_cr | Campaign creation timestamp |
keyword | Campaign key, same as in Tracking URL |
group_id | Group Id |
group_name | Group name |
ts_name | Traffic source |
ts_id | Source Id /td> |
start_date | Timestamp of the first click in the campaign |
clicks | Number of clicks for the selected period |
bots | Number of bots (for future functionality) |
profit | Campaign profit for selected period |
ROI | ROI |
lp_ctr | LP CTR = LP Clicks / Click * 100% |
leads | Number of conversions |
cr | CR (Conversion Rate) = Leads / Clicks * 100% |
epc | Average Revenue per click = Revenue / Clicks |
cpc | Average cost per click for the selected period = Spend / Clicks |
revenue | Income (Revenue) |
cost | Cost |
landing_clicks | Amount of landing views (LP Views) |
offer_clicks | Amount of clicks on land (LP Clicks) |
is_note | Campaign notes |
current_cpc | Current CPC |
auto_cpc | 1 - if auto CPC is set in the campaign, otherwise 0 |
url | Tracking URL of compaign |
Parameter | Description |
---|---|
order_name | Column number for sorting (API function output goes in sorted form). For example: &order_name=clicks - sort by clicks, &order_name=leads - by leads |
order_type | ASC - sort ascending, DESC - sort descending |
search_name | Apply a search by the Name column in report |
status | Filter by active, deleted and campaigns with traffic for the selected period. all - all campaigns, 2 - with traffic, 1 - active, 0 - deleted |
group | Filter by group of campaigns, &group=Group_ID. &group=all - all groups |
traffic_source | Filter by traffic source, &traffic_source=TS_ID. &traffic_source=all - all sources |
date | Time period 1 - today 2 - yesterday 3 - last 7 days 4 - last 14 days 5 - current month 6 - last month 7 - current year 8 - last year 9 - for all time 11 - current week 10 - custom time with additional requests of the form &date_s=2016-07-31+%7C+02%3A00&date_e=2016-07-31+%7C+02%3A00, value format: [YYYY]-[MM]-[DD]+%7C+[HH]%3A[MM] 12 - custom date with an additional query, form &date_s=2016-07-05&date_e=2016-07-06, value format [YYYY]-[MM]-[DD] |
This API function changes in 1.9.
The changes concern names of columns and some filters.
Campaign report
For example, let’s display a report for our test campaign, according to the landings.
By adding the &api_key parameter to the URL, we will get the following data:
[{
"level":"1",
"name":"test123321",
"clicks":"2,038",
"offer_clicks":"0",
"lp_ctr":"0.00%",
"leads":"92",
"cr":"4.51%",
"epc":"0.0045",
"cpc":"0.0100",
"revenue":"9.10",
"cost":"20.38",
"profit":"-11.28",
"roi":"-55.35%"
}]
Just like in the campaign report, you can change the URL parameters.
Parameter | Description |
---|---|
camp_id | Id of the campaigns on which the report is built |
&val_page=all | Add to your URL if you want to get the results of all report pages |
group1 group2 group3 | Accordingly, first, second and third grouping of the report. If you want a single-level report, you may not use the other parameters. 2 - grouping by paths 3 - by offers 4 - by lands 5 - by rules 6 - ISP / Carrier 30 - Connection type 7 - IP 8 - IP-range 1.2.3.xxx 9 - IP-range 1.2.xxx.xxx 10 - Device type 29 - Device name 11 - Device brand 12 - Device model 13 - Screen Resolution 14 - Connection speed 15 - Browser name 16 - Browser with version 17 - OS 18 - OS with version 19 - Country 21 - Language 22 - Affiliate network 24 - Referral Domain 23 - Referral URL 25 - Day of the week 26 - Hour of the day 31 - Group by days 27 - Grouping by the first token 282, 283 .. 290 - Grouping by 2-10 tokens |
date | Time interval 1 - today 2 - yesterday 3 - last 7 days 4 - last 14 days 5 - current month 6 - last month 7 - current year 8 - last year 9 - for all time 11 - current week 10 - custom time with additional requests of the form &date_s=2016-07-31+%7C+02%3A00&date_e=2016-07-31+%7C+02%3A00, value format: [YYYY]-[MM]-[DD]+%7C+[HH]%3A[MM] 12 - custom date with an additional query, form &date_s=2016-07-05&date_e=2016-07-06, value format [YYYY]-[MM]-[DD] |
FILTERS APPLICATION
Our tracker allows you to apply saved filters for reports. For example, you can get a ready-made blacklist for your campaign. To do this, create and save a filter on the report page of any campaign - it will appear in the list of saved filters. Next to his name will be a digit. Remember it.
Add the &fid=N
parameter, where N is the filter number in your API URL for the campaign statistics and you will receive a filtered report.
Update costs
The tracker allows you to change the cost of your traffic through API. To do this, use the following URL:
http://track_domain.com/?page=save_update_costs&camp_id=1&date=1&timezone=3&token_number=1&token_value=100&cpc=0.005&api_key=123456789vf8fhj
Parameter | Description | Example |
---|---|---|
camp_id | Compaigns ID on which the report is built | 23 |
order_type | 1 - Cost (full cost), 2 - CPC (cost per click) | 1.5 |
date |
Time interval 1 - today 2 - yesterday 3 - last 7 days 4 - last 14 days 5 - current month 6 - last month 7 - current year 8 - last year 9 - for all time 11 - current week 12 - custom date | 1 |
date_s or date_e | Start and end date (при &date=12). Format of the values [YYYY]-[MM]-[DD] | &date_s=2016-08-01&date_e=2016-08-02 |
timezone | The time zone of the traffic source. If it is different from the tracker’s, the update of costs will occur with an offset. The value is from -12 to 12. | -2 |
token_number | Number of the token if you want to update costs based on a certain value of the token (for example, by publishers) | 2 |
token_value | Value of the token | pubdomain.com |
cost or cpc | New cost of the click, or total cost of the traffic per period (depending on the type of update) | cost=23.5, cpc=0.05 |
Add, change, delete, restore list of offers and landings
Tracker allows you to add, modify, delete and restore deleted offers and landings. All requests in API for creating / deleting offers go through the index.php file in the root folder of the tracker: http://tracker.com/index.php
Requests can be sent either through GET or via POST. In order to access functionality, you must pass parameter api_key in request to index.php with the value of the API key, which you can get in the tracker settings.
To determine the action, you must pass the parameter action.
Аction is composed like this - [manipulation object]_[action]
.
There are two objects - offer
and landing
List of possible actions: get, getall, delete, restore, add, edit
ACTIONS AND PARAMETERS
Action | Description | Mandatory parameters |
---|---|---|
offer_get | Gain information about offer | id |
offer_getall | Gain list of offers | without parameters |
offer_delete | Offer delete | id |
offer_restore | Restore deleted offer | id |
offer_edit | Edit offer | id |
offer_add | Create new offer | Mandatory parameters: name, url, payout. If auto_payout parameter is specified, you don't have to use payout |
landing_get | Gain information about the Landing | id |
landing_getall | Gain list of landings | Без параметров |
landing_delete | Land delete | id |
landing_restore | Restore deleted land | id |
landing_edit | Edit land | id |
landing_add | Create new land | name, url |
source_getall | Gain list of traffic sources | without parameters |
PARAMETERS FOR WORK WITH OFFER
Parameter | Description | Example |
---|---|---|
name | Offer Name | MyOfferName |
url | Offers URL (with tokens) | http://offer.com/?a=19892&c=1232&s2={clickid} |
network | Affiliate network's ID (see Aff Networks for details) | 3 |
payout | Payout, if auto, than don't have to specify | 1.2 |
status | 0 - Offer deleted, 1 - Active | 1 |
geo | Country (abbreviated) | US, RU, FR, UK |
group_of | Id of offer's group | 2 |
auto_payout | 1 - if auto, 0 - if not | 0 |
upsell | 1 - if Upsell enabled for offer, 0 - if not | 0 |
PARAMETERS FOR WORKING WITH LANDING
Parameter | Description | Example |
---|---|---|
name | Land's name | MyLanderName |
url | Land's URL (with tokens) | http://lander.com/1/index.php?device_name={device_name} |
status | 0 - deleted land, 1 - active | 1 |
lang | Language (abbreviated as in the tracker) | EN, RU, AR, ES |
group_lp | Id of the land's group | 23 |
offers | Amount of offers on land (multi-offers) | 1 |
EXAMPLES
Script:
$.ajax({
Will change the name of the 10th offer to BornByBinomAPI
type:"post",
url:"http://tracker.com/index.php",
data: {
"api_key" : "12345678qwertyu",
"action" : "offer_edit",
"id" : "10",
"name" : "BornByBinomAPI"
}
});
EXECUTE RESULTS
If change was successful, server sends json with the status
parameter: added, edited, restored
So the answer to the example above is {"status":"edited"}
If any errors occur, json returns with the "error" parameter, for example:
Response to an attempt to restore (offer_resore) for non-existent offer will be {"error":"Object not found"}