Skip to documentation
Link 2 Link / Docs
Documentation home
Browse documentation

Measure results

A/B tests & conversions

Run a two-destination experiment and submit conversion events from your own backend.

Current product guide · Reviewed October 28, 2026

Configure A and B

  1. Open Analytics and select a link you can edit. The normal destination is variant A.
  2. Enable the experiment and provide a valid public destination B. The split is an equal random choice, not a configurable weighted allocation.
  3. Save. The visitor’s session keeps its assignment for that experiment revision. Saving settings starts a new revision and resets subsequent assignment decisions.

This is session-based assignment, not a persistent person identity. Different browsers, cleared cookies or new sessions can receive different variants. There is no built-in significance calculator, automatic winner or geo/device routing.

Enable conversion receipts deliberately

Enable conversion tracking only after reading and accepting the tracking acknowledgment in the editor. Each qualifying redirect adds li2li_receipt to the destination query string, preserving other query parameters and the fragment. The encrypted receipt expires after 24 hours by default. It identifies an attribution opportunity and can appear in destination logs; treat it as sensitive and avoid forwarding it to unrelated services.

Capture the receipt at your destination and pass it to your trusted backend. Create a token with conversions:write for the same scope. Never place that API token in browser JavaScript. This requires an integration on the destination site; selecting a checkbox alone cannot detect a purchase.

Submit one stable event ID

Bash example

curl https://li2.li/api/conversions \
  -H "Authorization: Bearer $LI2LI_TOKEN" \
  -H "Accept: application/json" -H "Content-Type: application/json" \
  --data '{"receipt":"RECEIPT_FROM_DESTINATION","event_id":"11111111-1111-4111-8111-111111111111","event":"signup"}'

Python example

import os
from li2li_api import request
status, result = request("POST", "/api/conversions", {
    "receipt": os.environ["LI2LI_RECEIPT"],
    "event_id": "11111111-1111-4111-8111-111111111111", "event": "signup"})
if status != 200:
    raise RuntimeError(f"Conversion failed: HTTP {status}")
# result["recorded"] can be false for a duplicate; that is not a second conversion.

Java example

// Use your JSON library to serialize dynamic receipt text; never concatenate it into JSON.
// This complete fixed placeholder illustrates the request shape only.
var response = Li2liApi.request("POST", "/api/conversions",
    "{\"receipt\":\"RECEIPT_FROM_DESTINATION\",\"event_id\":\"11111111-1111-4111-8111-111111111111\",\"event\":\"signup\"}");
if (response.statusCode() != 200) throw new IllegalStateException("Conversion failed");
// Read recorded with your JSON library; false means no additional conversion recorded.

json · example

{"link_id":42,"recorded":true}

event must be lead, signup or purchase. Generate a UUID for the logical event and reuse it when retrying that same event. A duplicate for the link returns recorded:false rather than incrementing again. Do not generate a fresh UUID on every retry. The endpoint accepts at most 60 requests per minute.

Reuse the API quickstart helper. Keep the same event_id for retries of one logical conversion. Read the receipt from your destination integration; the environment variable below is an example handoff, not a server-issued API credential. Do not log it.

Handle errors without inventing conversions

An invalid, expired or disabled receipt returns a validation error; inaccessible links or the wrong token scope are rejected. Stop when the underlying link is unavailable. Do not manufacture receipts or repeatedly submit new event IDs to force an increment. Receipts expire and deduplication records have a retention limit; this is not an indefinite financial ledger.

Still need a hand?

Use Help & support in your dashboard or support@li2.li. Share the action and a sanitized error, never a password, token or private reset link.