How to

Implement Server-to-Server Tracking for Leads

This page explains the process of implementing the server-to-server tracking for Retrack.

Sign in to the platform

Click here to access your account.

Find your API token

Each user is given an API token which you can find once signed in to the platform. Click on your name on the top right part of the screen and then select "Profile" from the dropdown menu. You should be presented with this view where your API token is displayed:

API token

Create a redirect page

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. The click identifier should be saved for later use and must persist for 10 days. You can choose to save it in a coookie, in the session, or any other way that makes it persistant. Once the click identifier is stored the user should be redirected to the deeplink URL.

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

POST https://retrack-app.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.

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.