This page explains the process of implementing the server-to-server tracking for Retrack.
Sign in to the portal
Click here to access your account.
Find your API token
Each user is given a unique API token. To find it, sign in to the portal and click your avatar in the top right corner and select "Profile". Your API token is displayed there and can be copied with one click.
Create a redirect page
Whether a redirect page is required depends on how your program is configured in Retrack. Each program has a Uses Redirect Page setting that can be toggled on or off. Check this setting on your program before proceeding.
When enabled, Retrack sends the user to your redirect page first. The redirect page saves the click identifier in a cookie and then forwards the user to the actual destination. Without this step, the tracking script on your confirmation page has no way of linking a lead or purchase back to the original click.
You will receive traffic from Retrack with the following two URL parameters: click and deeplink. Here is one example:
https://www.store-domain.com/retrack?click=625fae10-1eb0-11eb-adc1-0242ac120002&deeplink=https%3A%2F%2Fwww.store-domain.com%2Fsome-product
Create a new page that can accept these two parameters. Save the click identifier in a cookie named retrack_click with a 10-day expiration. Once stored, redirect the user to the deeplink URL.
document.cookie = `retrack_click=${click};expires=${expires};path=/;secure;samesite=lax`;
The redirect URL can be any URL on your main store domain. Just make sure to communicate the exact URL of this page to Retrack.
Send leads to Retrack
Whenever a lead is generated, you should check if it's affiliated with Retrack based on the cookie you set initially. All connected leads should be uploaded to Retrack using our API as soon as possible.
API Endpoint
https://retrack.refunder.com/api/v2/leads
Authenticate by passing your API token with the Authorization header. For example:
Authorization: Bearer DbV6KYhMm7firiNtgfOCEmRohglfAQUTUy4FudGOKtetC0yYSaKtOXIedfNX
Example input:
{
"event": "1f80e399-6f55-4cef-b8b0-0f74752c1ceb",
"click": "59d08c54-18e6-4e0d-9c06-d18be3510e43",
"reference": "testabc123",
"voucher": "vouchercode"
}
Example response:
{
"data": {
"uuid": "3afc4a82-93c3-423f-8ee8-542ccb315931",
"reference": "testabc123",
"commission": 4000,
"currency": "SEK",
"vouchers": ["vouchercode"],
"created_at": "2020-11-04 11:09:31",
"click": {
"uuid": "59d08c54-18e6-4e0d-9c06-d18be3510e43",
"ref": "38315327",
"ref2": null,
"ref3": null,
"deeplink": null,
"ip_address": "80.216.223.143",
"browser": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36",
"referer": "https://www.refunder.se/",
"country": "SE",
"created_at": "2020-10-08 08:13:43"
},
"publisher": {
"uuid": "e5adcbc6-31a8-4e1b-8351-835dddc16921",
"name": "Refunder SE",
"created_at": "2020-05-19 15:44:36"
},
"advertiser": {
"uuid": "4062146a-9078-4e9a-8a88-2b9066c562d2",
"name": "Store Name SE",
"created_at": "2020-05-19 15:46:02"
},
"program": {
"uuid": "7649bf56-4345-46e4-8c77-04bbd2f3bcd3",
"title": "Store Name SE",
"created_at": "2020-05-19 15:47:02"
},
"event": {
"uuid": "1f80e399-6f55-4cef-b8b0-0f74752c1ceb",
"title": "Sale Whole Store",
"commission": "4000",
"created_at": "2020-05-19 15:48:46"
},
"status": {
"name": "pending",
"reason": null,
"created_at": "2020-11-04 11:09:31"
}
}
}
The API will return with HTTP 200 OK if the lead has been successfully saved. For all other responses you can retry as many times as you need.
Updating leads
You can update a lead by sending a POST request to the following endpoint. Pass the uuid of the lead you want to update in the URL.
https://retrack.refunder.com/api/v2/leads/:uuid
Rejecting leads
You can reject a lead by passing the status field with the value rejected. Example:
{
"status": "rejected"
}
Approving leads
You can approve a lead by passing the status field with the value approved. Example:
{
"status": "approved"
}
It's not possible to update a lead's status once it has been approved.
Possible status values
- pending
- rejected
- approved
Done
That's it! You have now implemented tracking for Retrack. We would now like to test the implementation before it goes live. Reach out to us with testing instructions.