KuikCodeDocs

Conversion tracking

Count the leads and sales a KuikLink brings, not only its clicks, and see each customer with the link that brought them.

Clicks tell you who arrived. Conversion tracking tells you what happened next: who signed up, who paid, and how much. It is included in the Business plan.

A click becomes a lead when the person does something you care about, like signing up or sending a form. A lead becomes a sale when they pay.

How it works

  1. You turn on Conversions on a link.
  2. Each click reaches your page with its own id added to the address, as kc_click.
  3. Your site keeps that id, and your server reports the lead and the sale to KuikCode with it.
  4. Leads, sales and revenue show in Analytics, under KuikLinks, and each person shows under Customers.

A link that opens a KuikPage needs no setup beyond the switch: when a visitor sends a form on the page, it counts as a lead on the link that brought them.

Turn it on

Open the link, open Advanced under Organize, turn on Track conversions for this link and save the link. Under the switch, the same three snippets as this page are ready to copy.

Set up your site

Add the script

Put this on every page of your site, before </body>:

<script src="https://app.kuikcode.com/kuikcode/links.js" defer></script>

It reads kc_click from the address, keeps it for 90 days in a cookie of your own site named kc_click, and removes it from the address bar. It sends nothing anywhere.

AttributeWhat it does
data-days="30"Keeps the id for 30 days instead of 90
data-cookie-domain=".example.com"Shares the id across your subdomains

Your server reads the cookie kc_click. In the page you can call window.kuiklinks.clickId(), and an <input type="hidden" name="kc_click"> in a form is filled in for you.

Report the lead

When the person signs up, call the API from your server with the click id and your own id for the person:

curl https://api.kuikcode.com/v1/track/lead \
  -H "Authorization: Bearer kc_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "clickId": "0b9ded04-78a6-42c0-8d4e-5590d221ea44",
    "customerId": "user_10432",
    "email": "ada@example.com",
    "name": "Ada Lovelace",
    "eventName": "Sign up"
  }'

customerId is how you name the person in your own system: a user id or an email. One lead counts per person and event name, so sending the same lead twice is safe.

Report the sale

When they pay, send the same customerId and the amount in the currency's smallest unit (4900 is 49.00):

curl https://api.kuikcode.com/v1/track/sale \
  -H "Authorization: Bearer kc_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "user_10432",
    "amount": 4900,
    "currency": "usd",
    "invoiceId": "in_1PqR2s"
  }'

The sale counts on the link that brought the person first. Send your own invoiceId so the same payment never counts twice. If you never sent a lead for this person, include clickId in the sale.

Keep your API key on your server

Both calls need your API key, so make them from your server, never from the browser. Create a key under Settings, Developers.

Read the results

  • Analytics, KuikLinks shows Leads, Sales and Revenue for the period, with the share of clicks that became leads and of leads that became sales. Each link in Top performing KuikLinks shows its own leads and sales.
  • Analytics, Customers lists each person with the link that brought them, what they did and how much they paid. Open a row to see every lead and sale.
  • A/B Test results show the leads and sales of each address next to its clicks, so you can keep the address that converts better.

Revenue in different currencies is shown separately and never added together.

Things to know

  • A person stays with the link that brought them first. A later click on another link can be a new lead there, but their sales count on the first link.
  • Only real visits get an id. Bots and link previews are not counted as clicks, so they carry none.
  • The cookie belongs to your site. If you list your cookies in a cookie notice, add kc_click.
  • To remove a person, open them under Customers and click Delete customer. Their leads and sales are removed with them.

On this page