The functions can work for both the webmaster and the team. For regular work, use the URL for user. For team-level work, use the URL for team with the key of any of the team leads.
Further in the text, important parameters are shown in curly brackets:
{token}- your API key from personal account, for example123-abdce.{key}- your postback key from any flow, for example666c93ba7cebe113.{flow}- symbolic identifier of a flow from the list, for exampleef1c.{click}- character ID of a click from the tracker, for exampleca1337.
Important! When using links and data, don't use curly braces, only the values themselves!
01 Contents
Back to contents02 Integration
Integration functions are responsible for connecting third-party services and transmitting conversion data.
Postback
URL https://www.altercpa.red/postbacks/{key}?click={click}
API URL for user https://www.altercpa.red/api/tracker/postback.json?id={token}&click={click}
API URL for team https://www.altercpa.red/api/gangs/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
clickparameter. The data for the lead is taken from the click ID. Used by default, this is the recommended approach. - Fallback operation: with the
flowandsubidparameters. The data for the lead is taken from the stream ID, the uniqueness of the request is determined by thesubidparameter. 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. |
create | Create new lead on each postback received. Value must be 1. |
price | Lead price (commission payment). |
addprice | Add amount to existing 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. |
cost | Lead cost (not commission!). |
addcost | Add amount to existing lead cost. |
costcur | Three-letter ISO code for the lead cost currency, by default usd. |
costconv | The ISO code of the currency to convert the cost 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. |
data3 | Custom data 3 to replace the one received from the click. |
data4 | Custom data 4 to replace the one received from the click. |
data5 | Custom data 5 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. |
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:
|
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 for user https://www.altercpa.red/api/tracker/spend.json?id={token}
URL for team https://www.altercpa.red/api/gangs/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 country. |
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. |
customer | The Customer 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:
|
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"
}
Back to contents
03 Statistics
Statistics functions provide access to reports on leads and clicks.
Leads list
URL for user https://www.altercpa.red/api/tracker/leads.json?id={token}
URL for team https://www.altercpa.red/api/gangs/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:
|
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:
|
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. |
customer | The value of Customer tag. |
user | User ID in team. |
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:
|
Inside the leads field, leads are represented by an associative array with fields:
| Field | Description |
|---|---|
id | Lead numeric ID. |
user | User ID in team. |
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:
|
status | Character status of the lead:
|
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. |
cost | Lead cost (not the commission price, it's above). |
costcur | Lead cost 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 |
adid | Ad click ID (fbclid, gclid, adclid, clid, adid). |
data1 | Custom data 1. |
data2 | Custom data 2. |
data2 | Custom data 3. |
data2 | Custom data 4. |
data2 | Custom data 5. |
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. |
customer | The value of Customer tag. |
subid | The value of subid tag. |
Example of a successful server response:
{
"status": "ok",
"leads": [
{
"id": 1,
"user": 13,
"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",
"cost": 35,
"costcur": "eur",
"ip": "12.34.56.78",
"geo": "de",
"name": "Hans",
"phone": "+49 (30) 226-511-83",
"email": "noreply@gmx.de",
"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",
"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",
"customer": "vendoso",
"subid": "purr"
},
...
]
}
Example of a server response with an error:
{
"status": "error",
"error": "payment-required"
}
Click statistics
URL for user https://www.altercpa.red/api/tracker/stats.json?id={token}
URL for team https://www.altercpa.red/api/gangs/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):
|
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:
|
hour | Lead arrival hour (number from 0 to 23). |
mobile | Traffic type:
|
os | Operating system:
|
browser | Browser:
|
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. |
customer | The value of Customer 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:
|
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. |
next | Amount of clicks moved to next step. |
per | Percent of clicks moved to next step. |
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 | Held leads earnings. |
ma | Approved leads earnings. |
mct | Total cost. |
mch | Held leads cost. |
mca | Approved leads cost. |
mmt | Average (mean) cost. |
mmh | Held leads average (mean) cost. |
mma | Approved leads average (mean) cost. |
cr | Conversion: the ratio of valid leads to unique clicks. |
crt | Total conversion: the ratio of all the leads to unique clicks. |
epc | EPC: the ratio of all earnings to unique clicks. |
epc | EPL: earn per approved and held leads. |
appr | Approve: the ratio of approved leads to valid ones. |
app | Total approve: the ratio of approved leads to all leads. |
cpc | Average cost per click. |
cpl | Average cost per lead in any status. |
cpx | Average cost per valid lead. |
cpa | Average cost per approved lead. |
spend | Total cost for all clicks. |
profit | Earnings: amount for approved leads minus expenses. |
roi | ROI as a percentage, where a positive number represents profit, zero represents a full return on investment, and -100 represents a complete loss. |
goal | The array with statistics for each individual goal. Contains the same fields as the rest of the statistics. |
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"
}
Back to contents