Integration
Integration functions are responsible for connecting third-party services and transmitting conversion data.
Postback
URL: https://www.altercpa.red/api/tracker/postback.json?id={token}&click={click}
The most important function of interaction with the tracker. Creates a new lead or modifies an existing lead based on the click or flow IDs sent. You can use two calling options:
- Standard operation: with the
click
parameter. The data for the lead is taken from the click ID. Used by default, this is the recommended approach.
- Fallback operation: with the
flow
and subid
parameters. The data for the lead is taken from the stream ID, the uniqueness of the request is determined by the subid
parameter. Suitable for cases where there is no concept of a click and a click on a link, for example, for application integration.
The function can take the following parameters as input:
Field |
Description |
click |
Character click ID. |
flow |
Character flow ID. |
uid |
Unique lead identifier on the advertiser's side. |
status |
Lead status, optimal: new , hold , approve , cancel , trash . |
goal |
Character ID of goal. |
price |
Lead price. |
currency |
Three-letter ISO code for the lead currency, by default usd . |
convert |
The ISO code of the currency to convert the payout amount to is not used by default. |
name |
Customer's name. |
phone |
Customer's phone (without validation and correction). |
email |
Customer's email (without validation and correction). |
comment |
Custom comment to the lead. |
meta[xxx] |
Custom lead field with name xxx . |
utm_source |
Tag UTM Source to replace the one received from the click. |
utm_campaign |
Tag UTM Campaign to replace the one received from the click. |
utm_content |
Tag UTM Content to replace the one received from the click. |
utm_term |
Tag UTM Term to replace the one received from the click. |
utm_medium |
Tag UTM Medium to replace the one received from the click. |
subid |
Tag SubID to replace the one received from the click. |
adid |
Ad click ID to replace the one received from the click. |
data1 |
Custom data 1 to replace the one received from the click. |
data2 |
Custom data 2 to replace the one received from the click. |
stn |
Status or list of statuses that are recognized as new lead. |
sth |
Status or list of statuses that are recognized as lead in hold. |
sta |
Status or list of statuses that are recognized as approved lead. |
stc |
Status or list of statuses that are recognized as cancelled lead. |
stt |
Status or list of statuses that are recognized as trash. |
ip |
Lead IP address. |
geo |
Two-letter ISO code of lead country. |
ua |
User-Agent of the lead to determine the OS and browser. |
referer |
Referer of the visit to replace the one received from the click. |
The result of the function is an associative array:
Field |
Description |
status |
The result of the operation: ok in case of success, error in case of an error. |
error |
Error code for status error with value from the list:
access - the specified click or flow does not belong to you.
bad-click - no click found with this ID.
bad-flow - no flow found with this ID.
db - a system error occurred while working with the database.
no-changes - no changes were required, the lead is already in the right state.
no-click - no click ID or flow specified.
|
id |
The numeric ID of the lead that the action was taken on. |
create |
If a new lead was created - true , if an existing one was changed - false . |
stage |
The status the lead is in: new , hold , approve , cancel , trash . |
Example of a successful server response:
{
"status": "ok",
"id": 1337,
"create": true,
"stage": "new"
}
Example of a server response with an error:
{
"status": "error",
"error": "no-changes"
}
Spend import
URL: https://www.altercpa.red/api/tracker/spend.json?id={token}
The function sets the click price for traffic according to the specified conditions. Allows you to use the ROI calculation functionality. Data can be transmitted in both GET and POST requests. The request must contain the cpc
or cost
parameters and at least one condition (dates, flow, UTM tags).
The function can take the following parameters as input:
Field |
Description |
cost |
The total price for all clicks during this period. |
cpc |
Price per one click. |
from |
The start date of the period in the format YYYY-MM-DD , Unix Timestamp, or any other format recognized by the strtotime function. |
to |
The end date of the period in the format YYYY-MM-DD , Unix Timestamp, or any other format recognized by the strtotime function. |
flow |
Character identifier of the flow. You can pass an array of identifiers. |
way |
Numeric identifier of the way within the flow. You can pass an array of identifiers. |
currency |
Three-letter ISO code for the click currency, by default usd . |
geo |
Two-letter ISO code of click counrty. |
domain |
The domain where click appeared. |
utm_source |
The UTM Source tag by which the click was registered. |
utm_campaign |
The UTM Campaign tag by which the click was registered. |
utm_content |
The UTM Content tag by which the click was registered. |
utm_term |
The UTM Term tag by which the click was registered. |
utm_medium |
The UTM Medium tag by which the click was registered. |
subid |
The SubID tag by which the click was registered. |
valid |
Set the price only for valid clicks: targeted clicks that pass the filter. |
unique |
Set the price only for unique clicks. |
You can also simultaneously update several price tags with one request; to do this, combine all requests into a batch
array and send it via POST, for example:
{
"batch": [
{
"flow": "face",
"cost": 1984,
"currency": "usd"
},
{
"from": "2020-04-04 00:00:00",
"to": "2020-04-07 23:59:59",
"cpc": 1.337,
"currency": "eur"
}
]
}
The result of the function is an associative array:
Field |
Description |
status |
The result of the operation: ok in case of success, error in case of an error. |
error |
Error code for status error with value from the list:
empty - no data to put into price tags.
|
ok / bad |
Number of successful and unsuccessful price setting requests. Usually contains the response ok=1 |
Example of a successful server response:
{
"status": "ok",
"ok": 1,
"bad": 0
}
Example of a server response with an error:
{
"status": "error",
"error": "empty"
}
Statistics
Statistics functions provide access to reports on leads and clicks.
Leads list
URL: https://www.altercpa.red/api/tracker/leads.json?id={token}
The function retrieves the list of leads and returns it as an associative array in the leads
field. The function has no formal limits on the number of leads displayed, but it is not recommended to load more than a thousand leads at a time. If you get a 500 error, it means that there was not enough memory for your request, you need to reduce the request period.
The function can accept the following GET filtering parameters as input:
Field |
Description |
from |
Report start date in YYYY-MM-DD format and tracker timezone. |
to |
Report end date in YYYY-MM-DD format and tracker timezone. |
ufrom |
Report start date in Unix Timestamp format. |
uto |
Report end date in Unix Timestamp format. |
status |
Character status of the lead:
new - new leads.
hold - leads in the hold.
approve - approved leads.
cancel - cancelled leads.
trash - leads in trash.
valid - valid leads (everything except trash).
wait - pending leads (new and hold).
good - good leads (hold and approve).
bad - bad leads (cancelled and trash).
|
geo |
Two-letter ISO code of lead country. |
flow |
Character flow ID. |
way |
Numeric way ID. |
click |
Character click ID. |
site |
Numeric site ID. |
goal |
Character goal ID. |
filter |
The result of the filters:
0 - target visits.
1 - blocked: bot.
2 - blocked: blacklist.
3 - blocked: country.
4 - blocked: language.
5 - blocked: filtering campaign.
|
domain |
The domain from which the lead was sent. |
ip |
Lead IP address. |
utm_source |
The value of UTM Source tag. |
utm_campaign |
The value of UTM Campaign tag. |
utm_content |
The value of UTM Content tag. |
utm_term |
The value of UTM Term tag. |
utm_medium |
The value of UTM Medium tag. |
subid |
The value of SubID tag. |
The result of the function is an associative array:
Field |
Description |
status |
The result of the operation: ok in case of success, error in case of an error. |
leads |
An array of leads, the composition of the fields is analyzed further. |
error |
Error code for status error with value from the list:
access - you are trying to access data that does not belong to you.
payment-required - your subscription has expired, renew your subscription.
|
Inside the leads
field, leads are represented by an associative array with fields:
Field |
Description |
id |
Lead numeric ID. |
time |
Lead arrival time in UNIX Timestamp format. |
click |
Character click ID. |
uid |
Unique lead identifier on the advertiser's side. |
flow |
Character flow ID. |
way |
Numeric way ID. |
site |
Numeric site ID. |
siteurl |
Site URL. |
filter |
The result of the filters:
0 - target visits.
1 - blocked: bot.
2 - blocked: blacklist.
3 - blocked: country.
4 - blocked: language.
5 - blocked: filtering campaign.
|
status |
Character status of the lead:
new - new lead.
hold - lead in the hold.
approve - approved lead.
cancel - cancelled lead.
trash - lead in trash.
|
custom |
Real statustext of the lead sent by the advertiser. |
goal |
Character goal ID. |
price |
Lead price (always available regardless of status). |
currency |
Lead price currency, by default usd . |
ip |
Lead IP address. |
geo |
Two-letter ISO code of lead country. |
name |
Customer's name. |
phone |
Customer's phone (without validation and correction). |
email |
Customer's email (without validation and correction). |
comment |
Lead comment. |
meta |
Array of additional lead fields. |
ua |
Browser User Agent |
referer |
The referrer from which the lead was sent. |
adid |
Ad click ID (fbclid , gclid , adclid , clid , adid ). |
data1 |
Custom data 1. |
data2 |
Custom data 2. |
domain |
The domain from which the lead was sent. |
utm_source |
The value of UTM Source tag. |
utm_campaign |
The value of UTM Campaign tag. |
utm_content |
The value of UTM Content tag. |
utm_term |
The value of UTM Term tag. |
utm_medium |
The value of UTM Medium tag. |
subid |
The value of subid tag. |
Example of a successful server response:
{
"status": "ok",
"leads": [
{
"id": 1,
"time": 1691303223,
"click": "ac13",
"uid": "c1vvkg272m16",
"flow": "ecb4",
"way": 123,
"site": 42,
"siteurl": "https://meow.pro/c8/cfb72fe561f0/",
"filter": 0,
"status": "approve",
"custom": "Confirmed",
"goal": "paid",
"price": 18,
"currency": "usd",
"ip": "12.34.56.78",
"geo": "de",
"name": "Hans",
"phone": "+49 (30) 226-511-83",
"email": "[email protected]",
"comment": "Confirmed on sunday",
"meta": {
"foo": "bar",
"bar": "foo"
},
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Safari\605.1.15",
"referer": "https://meow.pro/c8/cfb72fe561f0/?subid=purr",
"adid": "bf9d4aa8-4979-11ee-94c6-005056aec456",
"data1": "wj80b89eit8epaarikhe2oge",
"data2": false,
"utm_source": "fb",
"utm_campaign": "1013444211662",
"utm_content": "432211555332166",
"utm_term": false,
"utm_medium": false,
"domain": "meow.pro",
"subid": "purr"
},
...
]
}
Example of a server response with an error:
{
"status": "error",
"error": "payment-required"
}
Click statistics
URL: https://www.altercpa.red/api/tracker/stats.json?id={token}
The function collects general statistics on the number of clicks and leads, broken down by goals for the selected period according to the specified criterion.
The function can accept the following GET filtering parameters as input:
Field |
Description |
from * |
Report start date in YYYY-MM-DD format (required). |
to * |
Report end date in YYYY-MM-DD format (required). |
item * |
Element by which statistics are grouped (required):
date - the date the click and lead were received.
hour - hour of the click and lead.
flow - flow ID.
way - way ID.
site - site ID.
filter - filtering results.
geo - country.
mobile - device type.
os - operating system.
browser - browser.
ip - IP address.
utmd - domain.
subid - SubID tag.
utms - UTM Source tag.
utmc - UTM Campaign tag.
utmn - UTM Content tag.
utmt - UTM Term tag.
utmm - UTM Medium tag.
|
geo |
Two-letter ISO code of lead country. |
flow |
Character flow ID. |
way |
Numeric way ID. |
site |
Numeric site ID. |
filter |
The result of the filters:
0 - target visits.
1 - blocked: bot.
2 - blocked: blacklist.
3 - blocked: country.
4 - blocked: language.
5 - blocked: filtering campaign.
|
hour |
Lead arrival hour (number from 0 to 23). |
mobile |
Traffic type:
0 - desktop traffic.
1 - mobile traffic.
|
os |
Operating system:
0 - Other
1 - Windows
2 - MacOS
3 - Linux
4 - iOS
5 - Android
6 - Windows Mobile
7 - Symbian
8 - BlackBerry
|
browser |
Browser:
0 - Other
1 - Chrome
2 - Firefox
3 - MSIE
4 - Safari
5 - Opera
6 - Edge
7 - Facebook
8 - Instagram
9 - Tik-Tok
10 - WebView
11 - Bot
|
domain |
The domain from which the lead was sent. |
ip |
Lead IP address. |
utm_source |
The value of UTM Source tag. |
utm_campaign |
The value of UTM Campaign tag. |
utm_content |
The value of UTM Content tag. |
utm_term |
The value of UTM Term tag. |
utm_medium |
The value of UTM Medium tag. |
subid |
The value of subid tag. |
The result of the function is an associative array:
Field |
Description |
status |
The result of the operation: ok in case of success, error in case of an error. |
stats |
The array of statistics results, the composition of the fields is analyzed further. |
total |
The total results for the entire query. |
error |
Error code for status error with value from the list:
access - you are trying to access data that does not belong to you.
no-item - the criterion by which statistics should be groupped is not specified.
no-from - start date of statistics period is not specified.
no-to - end date of statistics period is not specified.
payment-required - your subscription has expired, renew your subscription.
|
The stats
array and the total
field are an associative array:
Field |
Description |
id |
Statistics element ID. |
name |
Statistics element name. |
click |
Total clicks amount. |
unique |
Unique clicks amount. |
total |
Total leads number. |
cv |
Valid leads number. |
cn |
New leads number. |
ch |
Hold leads number. |
ca |
Approved leads number. |
cc |
Cancelled leads number. |
ct |
Trash leads number. |
mt |
Total earnings. |
mh |
Holded leads earnings. |
ma |
Approved leads earnings. |
cr |
Conversion: the ratio of valid leads to unique clicks. |
epc |
EPC: the ratio of approved earnings to unique clicks. |
appr |
Approve: the ratio of approved leads to valid ones. |
app |
Total approve: the ratio of approved leads to all leads. |
goal |
The array with statistics for each individual goal. Contains the same fields as the rest of the statistics, except for the number of clicks. |
Example of a successful server response:
{
"status": "ok",
"stats": {
"20230805": {
"id": 20230805,
"name": "2023-08-05",
"click": 44,
"unique": 22,
"total": 6,
"cv": 4,
"cn": 1,
"ch": 1,
"ca": 2,
"cc": 0,
"ct": 2,
"mh": 20.0,
"ma": 135.0,
"mt": 155.0,
"cr": 18.2,
"epc": 6.75,
"appr": 66.7,
"app": 33.3
},
...
},
"total": {
"click": 175,
"unique": 58,
"total": 25,
"cv": 23,
"cn": 11,
"ch": 8,
"ca": 9,
"cc": 0,
"ct": 2,
"mh": 160.0,
"ma": 1200.0,
"mt": 1360.0,
"cr": 5.17,
"epc": 12.3,
"appr": 46.7,
"app": 31.0
}
}
Example of a server response with an error:
{
"status": "error",
"error": "no-item"
}