Conversion Tracking Setup Guide
In this guide: Learn how to enable conversion tracking for touchpoints, install the Li2 Analytics SDK, and prepare your system to track lead and sale events.
Prerequisites
Before you begin, ensure you have:Access Rights
Owner or Manager role in your organization
Touchpoint Created
At least one touchpoint to track conversions
Website/App Access
Ability to add JavaScript code to your web pages
Premium+ Plan
Premium plan or higher
Setup Process Overview
The conversion tracking setup consists of 4 main steps:Step 1: Enable Conversion Tracking for Touchpoint
1.1 Access Touchpoint Settings
Open Touchpoint Details
In your dashboard, navigate to Touch-Points and select the touchpoint you want to track conversions for.
1.2 Activate Conversion Tracking
In the Conversion Tracking section:- Toggle the switch to ON (green)
- Click Save Changes to apply
Enabling conversion tracking doesn’t affect your touchpoint’s current functionality. Short links, QR codes, and NFC tags continue to work normally. Tracking only begins once you integrate the SDK (Step 2).
Step 2: Install Li2 Analytics SDK
The Li2 Analytics SDK is a JavaScript library that automatically tracks conversions. There are 2 installation methods:- HTML / JavaScript
- WordPress
Installation for Regular HTML Websites
Add this script to the<head> or before </body> of all pages that need tracking:- Find the line:
s.setAttribute("data-publishable-key", "li2_pk_xxxxxxxx"); - Replace
li2_pk_xxxxxxxxwith your actual publishable key from Settings → Analytics
- In
<head>: Loads early, ensures tracking always works - Before
</body>: Doesn’t block page render, but might miss early events
Step 3: Configure Security
3.1 Set Up Allowed Hostnames
Allowed Hostnames is a list of domains permitted to send tracking requests. This is a critical security layer to prevent abuse.Add Allowed Hostnames
In the Security section, find Allowed Hostnames and add your domains:Examples:
example.com- Only allows exact domain*.example.com- Allows all subdomains (www, app, blog, etc.)localhost- Allows local development (recommended for dev)
| Pattern | Allows |
|---|---|
example.com | Only example.com |
www.example.com | Only www.example.com |
*.example.com | app.example.com, blog.example.com, etc. |
* | All domains (NOT recommended for production) |
3.2 Review Publishable Key
The publishable key is automatically generated when you enable Analytics. To view:- Go to Settings → Analytics
- Copy Publishable Key (format:
li2_pk_...) - Paste into SDK configuration (already done in Step 2)
Publishable vs Secret Key:
- Publishable key (
li2_pk_...): Safe to expose client-side, used for SDK - Secret key (
li2_sk_...): Server-side only, DO NOT expose to clients
Step 4: Verify Setup
4.1 Test Click ID Capture
After installing the SDK, test whether click IDs are being captured correctly:Create Test Link
From the touchpoint with conversion tracking enabled, copy the short link (e.g.,
li2.link/test-campaign)Check Cookie
Open Developer Tools (F12) → Application → CookiesLook for a cookie named
li_cid with a value like: cm3w...✅ Success if cookie exists❌ Failed if no cookie → Recheck SDK installationDon't see li_cid cookie?
Don't see li_cid cookie?
li2Analytics undefined in console?
li2Analytics undefined in console?
Causes:
- Script hasn’t finished loading: Wait for page to fully load and try again
- CDN blocked: Check Network tab to see if request to unpkg.com is blocked
- Ad blocker: Disable ad blocker and test again
Tracking requests getting CORS errors?
Tracking requests getting CORS errors?
Cause:
- Current domain not in Allowed Hostnames
- Go to Settings → Analytics → Allowed Hostnames
- Add current domain (e.g.,
example.com) - Save and test again
4.2 Test End-to-End Flow (Optional)
To test the complete flow from click → lead tracking:Complete! 🎉
You’ve successfully set up conversion tracking! Next steps:Track Lead Events
Learn how to track when customers sign up or show interest
Track Sale Events
Learn how to track revenue when customers make purchases
GTM Integration
Set up conversion tracking via Google Tag Manager
Advanced Setup
Configure conversion goals and custom events
Troubleshooting
Conversion tracking toggle is disabled (grayed out)?
Conversion tracking toggle is disabled (grayed out)?
Cause: Organization doesn’t have Premium plan.Fix:
- Go to Settings → Billing
- Upgrade to Premium or higher
- Or start Premium Trial to test
SDK loads slowly, affecting page speed?
SDK loads slowly, affecting page speed?
Solutions:
- SDK is already optimized with
deferloading - doesn’t block page render - Global CDN distribution ensures low latency
- Minified bundle size < 10KB
Tracking not working on mobile app?
Tracking not working on mobile app?
Li2 Analytics SDK currently only supports web tracking (JavaScript).For mobile apps: Use Server-side tracking with API keys. See Events Tracking - Server-side.
How to know which touchpoints have conversion tracking enabled?
How to know which touchpoints have conversion tracking enabled?
In Touch-Points list, look for 📊 icon next to touchpoint name. This icon only appears when conversion tracking is enabled.Or filter touchpoints with Advanced Filters → Conversion Tracking = Enabled.

