Track a conversion
curl --request POST \
--url https://trimyourl.com/api/v1/convert \
--header 'Content-Type: application/json' \
--data '
{
"kid": "click-id-from-query-or-cookie",
"client": "trk_ab12cd34ef56",
"event": "purchase",
"value": 49.99,
"currency": "USD",
"orderId": "1001"
}
'import requests
url = "https://trimyourl.com/api/v1/convert"
payload = {
"kid": "click-id-from-query-or-cookie",
"client": "trk_ab12cd34ef56",
"event": "purchase",
"value": 49.99,
"currency": "USD",
"orderId": "1001"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
kid: 'click-id-from-query-or-cookie',
client: 'trk_ab12cd34ef56',
event: 'purchase',
value: 49.99,
currency: 'USD',
orderId: '1001'
})
};
fetch('https://trimyourl.com/api/v1/convert', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://trimyourl.com/api/v1/convert",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'kid' => 'click-id-from-query-or-cookie',
'client' => 'trk_ab12cd34ef56',
'event' => 'purchase',
'value' => 49.99,
'currency' => 'USD',
'orderId' => '1001'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://trimyourl.com/api/v1/convert"
payload := strings.NewReader("{\n \"kid\": \"click-id-from-query-or-cookie\",\n \"client\": \"trk_ab12cd34ef56\",\n \"event\": \"purchase\",\n \"value\": 49.99,\n \"currency\": \"USD\",\n \"orderId\": \"1001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://trimyourl.com/api/v1/convert")
.header("Content-Type", "application/json")
.body("{\n \"kid\": \"click-id-from-query-or-cookie\",\n \"client\": \"trk_ab12cd34ef56\",\n \"event\": \"purchase\",\n \"value\": 49.99,\n \"currency\": \"USD\",\n \"orderId\": \"1001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://trimyourl.com/api/v1/convert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"kid\": \"click-id-from-query-or-cookie\",\n \"client\": \"trk_ab12cd34ef56\",\n \"event\": \"purchase\",\n \"value\": 49.99,\n \"currency\": \"USD\",\n \"orderId\": \"1001\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"event": "purchase",
"slug": "spring-launch"
}Conversions
Track a conversion
Credits a lead or sale to a short-link click. CORS is open. Prefer the tracking snippet on the destination site; call this endpoint from a server when the snippet cannot run. If orderId was already credited, the response is { ok: true, duplicate: true }.
POST
/
api
/
v1
/
convert
Track a conversion
curl --request POST \
--url https://trimyourl.com/api/v1/convert \
--header 'Content-Type: application/json' \
--data '
{
"kid": "click-id-from-query-or-cookie",
"client": "trk_ab12cd34ef56",
"event": "purchase",
"value": 49.99,
"currency": "USD",
"orderId": "1001"
}
'import requests
url = "https://trimyourl.com/api/v1/convert"
payload = {
"kid": "click-id-from-query-or-cookie",
"client": "trk_ab12cd34ef56",
"event": "purchase",
"value": 49.99,
"currency": "USD",
"orderId": "1001"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
kid: 'click-id-from-query-or-cookie',
client: 'trk_ab12cd34ef56',
event: 'purchase',
value: 49.99,
currency: 'USD',
orderId: '1001'
})
};
fetch('https://trimyourl.com/api/v1/convert', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://trimyourl.com/api/v1/convert",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'kid' => 'click-id-from-query-or-cookie',
'client' => 'trk_ab12cd34ef56',
'event' => 'purchase',
'value' => 49.99,
'currency' => 'USD',
'orderId' => '1001'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://trimyourl.com/api/v1/convert"
payload := strings.NewReader("{\n \"kid\": \"click-id-from-query-or-cookie\",\n \"client\": \"trk_ab12cd34ef56\",\n \"event\": \"purchase\",\n \"value\": 49.99,\n \"currency\": \"USD\",\n \"orderId\": \"1001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://trimyourl.com/api/v1/convert")
.header("Content-Type", "application/json")
.body("{\n \"kid\": \"click-id-from-query-or-cookie\",\n \"client\": \"trk_ab12cd34ef56\",\n \"event\": \"purchase\",\n \"value\": 49.99,\n \"currency\": \"USD\",\n \"orderId\": \"1001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://trimyourl.com/api/v1/convert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"kid\": \"click-id-from-query-or-cookie\",\n \"client\": \"trk_ab12cd34ef56\",\n \"event\": \"purchase\",\n \"value\": 49.99,\n \"currency\": \"USD\",\n \"orderId\": \"1001\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"event": "purchase",
"slug": "spring-launch"
}Body
application/json