# Click API

Available only for Professional and Business licenses.

Click API is an interface to work remotely with Keitaro's campaigns. It allows to make requests and get responses from Keitaro on external websites.

# Differences from KClient PHP

KClient PHP is a ready client (an integration script) that is based on a Click API V3. KClient PHP already has the basic methods of the Click Api v3 work and the automatic click transfer and the description of the tracker's response.

Read more at KClient.php.

# Click API requests

Campaign token should be sent while sending the requests to API. The token can be taken from the necessary campaign settings in the Click API token field on the left.

Make sure you use the correct prefix to access the client:

/click_api/v3/

The request and response examples:

curl "http://domain_tracker/click_api/v3?token=ebd928ea&log=1&info=1"

{
    "body": null,
    "contentType": "text/html; charset=utf-8",
    "headers": [
        "Location: http://domain.com/?data=&utm-campaign=aff1"
    ],
    "info": {
        "campaign_id": 2,
        "stream_id": 1117,
        "sub_id": "o2q6e42hs08jq",
        "type": "location",
        "url": "http://domain.com/?data=$keyword&utm-campaign=aff1"
    },
    "log": [
        "Processing campaign 2",
        "Referrer: ",
        "Source: ",
        "Keyword: ",
        "IP: 127.0.0.1",
        "UserAgent: HTTPie/0.6.0",
        "Language: ",
        "Is unique in campaign: no",
        "Checking stream #1282",
        "Filter  \"uniqueness\": allow",
        "Filter \"uniqueness\": rejected",
        "Checking stream #1343",
        "Filter \"region\": rejected",
        "Checking stream #1355",
        "Filter  \"limit\": allow",
        "Filter \"ip\": rejected",
        "Checking stream #1117",
        "Accepted by filters",
        "Stream #1117",
        "Send headers: Location: http://domain.com/?data=&utm-campaign=aff1",
        "[Profiler] 0.101 sec.  1 sql queries, 9MB (+7MB)"
    ],
    "uniqueness_cookie": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoie1wic3RyZWFtc1wiOntcIjExMTdcIjoxNDkwNzA1MTQyfSxcImNhbXBhaWduc1wiOntcIjJcIjoxNDkwNzA1MTQyfSxcInRpbWVcIjoxNDkwNzA1MTQyfSJ9._u5H9oOOdyp02VTnDN8VG47oLDoqRHHKyYI3ChxRqw8"
}

# Parameters

  • ip — IP address of the IPv4 type
  • user_agent
  • language
  • landing_id
  • uniqueness_cookie — current contents of the cookie
  • log — if you need the log of a click processing (1 or 0)
  • info — return info block (1 or 0)
  • force_redirect_offer — performs offer direct if it is chosen (1 or 0)

# Response

Response is returned in JSON format. Its attributes are:

Attribute Type Description
headers array Array of header responses
body string Body of the response (for example, the page text)
contentType string Response type (In the case of json it is "application/json; charset=utf-8")
uniqueness_cookie string Cookie that you must send in further requests to Click API
cookies_ttl int How many hours to store cookies on website side
log array Contents of the click processing log
info object Container with information by click
info.sub_id string
info.campaign_id int
info.stream_id int
info.landing_id int
info.offer_id array
info.token string
info.uniqueness array
info.uniqueness.campaign boolean
info.uniqueness.stream boolean
info.uniqueness.global boolean
info.is_bot boolean

# How to send to an offer

Create the link of the following format:

http://trackerdomain.com/?_lp=1&_token=info.token

You'll get info.token at your first API request.

# How to get a click's subid and write it to the variable using Click API v3

An example:

$url = "https://domain_tracker/click_api/v3?token=szvkqdf1tk28n9pkwwk3t8tbv4v9&info=1";
$response = json_decode (file_get_contents ($url));
$subid = $response->info->sub_id;
var_dump($subid)
Last Updated: 4/19/2021, 5:29:08 AM