Skip to main content

Lead conversion tracking

After this guide, you will know how Linkster's lead tracking endpoint works and how to use it for your tracking needs. It is highly recommended that you read the overview to tracking methods guide first.

Lead conversion tracking can be used to track user actions and basic sales data like newsletter sign-ups, account registrations, event books and many more.

info

If you want to specifically track shopping baskets/sales from your web store, please use sale conversion tracking instead.

caution

The user tracking container must be installed first before you can start tracking leads with Linkster.

A lead conversion request consists of a basic HTTP GET request to this endpoint:

https://trck.linkster.co/trck/etrack/
note

The lead conversion tracking endpoint requires a trailing slash (/etrack/).

Endpoint parameters

All parameters must be passed as URL parameters to the lead conversion tracking request:

URL parameterRequiredDescription
campaign_idrequiredThe Linkster campaign ID of your site/web store. Must be the same value as you have used for the user tracking container.
trigger_idrequiredIf you are tracking a lead, use 4. If you are tracking a sale, choose between 1 for default customer or 2 for new customer.
trackidoptional*EMID value stored in localStorage or document.cookie. Read more about on how to access the EMID value here.
vcoptional*Cleaned voucher code string.
order_categoryoptionalAn optional category string to group lead requests.
ordertokenoptionalAn ID that will be used to uniquely identify a lead tracking request. If no ordertoken is sent, Linkster will generate a radom one for you.
currencyoptional**Three character ISO 4217 currency code of the sale. E.g. EUR or USD.
total_turnoveroptional**Total net turnover with deducted discounts. Can be a float or integer: 9.99, 0, etc... Read more about on how to calculate net prices with deducted discounts here.

* either trackid (EMID) or vc must be set, so that Linkster can successfully attribute the requests to an influencer. For more information, read: EMID and voucher code attribution.

** only required if you want to track sales.

Order category

To group lead or sale tracks, an optional order_category can be sent with a tracking request. This category must be passed as a snake_case string, like: newsletter_sign_up or account_registration to the endpoint.

The following characters are allowed: a-z, 0-9 and _.

Valid examples

  • newsletter_sign_up
  • en_us
  • customer_since_2_years

Invalid examples

  • category with whitespace
  • my/category#1
  • account_régisträtion

Order categories are processed automatically. You can use them later to filter sales and lead statistics in the Linkster app.

Ordertoken

If you are sending an ordertoken with your lead track, Linkster will check if a lead request with the same ordertoken already exists and updates it instead of creating a new track.

Since it is not always possible to send an ordertoken, Linkster will generate a random ID if no ordertoken is sent with the request.

Examples

With the gained knowledge from above, we are ready to build and send lead tracking requests.

These examples assume that the user tracking container is correctly installed.

We will be using 19 as an example campaign_id, but you want to use your own campaign ID.

Tracking newsletter sing-ups (example)

...

<form id="newsletterSignUpForm" action="/newsletter-sign-up" method="post">
<input type="email" name="email" id="newsletterEmail">
<input type="submit" value="Subscribe to newsletter">
</form>

<script>
document.querySelector("#newsletterSignUpForm").addEventListener("submit", function () {
// getting the EMID value
var cookieEmid = document.cookie.match(/emid\=([a-zA-Z0-9\-\_]+)/i);
var emid = window.localStorage['emid'] || (cookieEmid === null || cookieEmid === void 0 ? void 0 : cookieEmid[1]);

// setting lead track params
var campaignId = 19;
var triggerId = 4;
var orderCategory = "newsletter_sign_up";
var voucherCode = undefined; // no voucher code is used for this example

var url = "https://trck.linkster.co/trck/etrack/";
url += "?campaign_id=" + campaignId;
url += "&trigger_id=" + triggerId;
url += "&trackid=" + emid;
url += "&order_category=" + orderCategory;
url += "&vc=" + encodeURIComponent(voucherCode);

// sending the tracking request
var req = new XMLHttpRequest();
req.withCredentials = true;
req.open("GET", url);
req.send();
});
</script>

...

Tracking paid event bookings (example)

...

var trackEventBooking = function (ordertoken, total_turnover, currency, voucherCode) {
// getting the EMID value
var cookieEmid = document.cookie.match(/emid\=([a-zA-Z0-9\-\_]+)/i);
var emid = window.localStorage['emid'] || (cookieEmid === null || cookieEmid === void 0 ? void 0 : cookieEmid[1]);

// setting lead track params
var campaignId = 19;
var triggerId = 1; // or 2 for a new customer
var orderCategory = "event_booking";

var url = "https://trck.linkster.co/trck/etrack/";
url += "?campaign_id=" + campaignId;
url += "&trigger_id=" + triggerId;
url += "&trackid=" + emid;
url += "&order_category=" + orderCategory;
url += "&vc=" + encodeURIComponent(voucherCode);
url += "&total_turnover=" + total_turnover;
url += "&ordertoken=" + ordertoken;
url += "&currency=" + currency;

// sending the tracking request
var req = new XMLHttpRequest();
req.withCredentials = true;
req.open("GET", url);
req.send();
}

// triggering the track
trackEventBooking("100001", 98.31, "EUR", "SAVE10");

...