Documentation
Everything you need to integrate LeadFnF Analytics into any website in minutes.
Quickstart
Add this single script tag to the <head> of every page you want to track. That's all you need.
<head> ... <script src="https://leadfnf.com/js/lf.js" data-site="YOUR_SITE_UUID" async></script> </head>
Find your Site UUID in the Sites dashboard after adding your site. Copy it from the snippet page.
Enable Session Recording
Add data-record="true" to load rrweb and begin capturing session replays. Recordings are stored based on your plan's replay limit and retention period.
<script src="https://leadfnf.com/js/lf.js" data-site="YOUR_SITE_UUID" data-record="true" async></script>
Custom Events — JavaScript API
Track any user action using window.lf.track(). Accepts an event name and an optional properties object.
No setup required. You don't pre-register events. The first time an event is received it appears automatically under Dashboard → Events. Tip: use the built-in Event builder there to generate a ready-to-paste snippet.
// Track a custom event with properties window.lf.track('signup_completed', { plan: 'pro', source: 'landing_page', value: 49 }); // Track a simple event (no properties) window.lf.track('newsletter_subscribed'); // Track a purchase window.lf.track('purchase', { order_id: 'ord_abc123', revenue: 99.00, currency: 'USD' });
Auto-capture via HTML Attributes
Track clicks on any element without writing JavaScript. Add data-lf-track to any HTML element.
<!-- Simple click tracking --> <button data-lf-track="upgrade_clicked"> Upgrade Plan </button> <!-- Track with link clicks --> <a href="/checkout" data-lf-track="checkout_started"> Checkout </a>
Server-side API
Track backend events — purchases, signups, fulfilment steps — from your server using your API key. Find your API key in Settings → API Key.
POST /api/v1/event
X-API-Key: sk_live_...
curl -X POST https://leadfnf.com/api/v1/event \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "site_id": "YOUR_SITE_UUID", "event": "purchase", "properties": { "order_id": "ord_abc123", "value": 99, "currency": "USD" } }'
- In the browser, read
sessionStorage.getItem('lf_session_' + YOUR_SITE_ID)and send it to your backend (e.g. a hidden form field). - Forward it as
"session_uuid"in the POST body. The response returns"session_matched": truewhen it linked successfully.
{"ok": true, "session_matched": true}
User Identification
Associate a session with a known user after login. Useful for connecting analytics to your user database.
window.lf.identify('user_12345', { email: 'alice@example.com', plan: 'pro', created_at: '2025-01-15' });
GDPR & consent — read before using identify
Everything you pass to identify() — user IDs, email addresses, custom traits — is personal data under GDPR. Unlike LeadFnF's anonymous tracking, this data can identify a person, so different rules apply:
- You are the data controller for identified data; LeadFnF acts as your processor. Disclose this in your own privacy policy.
- Establish a legal basis first. Typically the user's consent or your contract with them (e.g. terms accepted at signup). Only call
identify()for authenticated users covered by that basis — never for anonymous visitors. - Document it. Record when and how the user agreed, and cover analytics processing in your terms or consent flow.
- Minimize. Pass an internal user ID instead of an email address where possible — it is just as useful for connecting sessions to your database.
- Deletion requests: identified data is removed when you delete the site or your account; contact support for individual-user erasure to honor Article 17 requests.
Identified attributes are never sent to third-party AI services. See our Privacy Policy for the full sub-processor list.
Lead Capture FnF Connect add-on
Turn contact-form submissions into contacts, each linked to the visit that produced it: source, campaign, landing page, pages viewed and replay. Switch it on per site under Sites → Settings → Lead capture. No code changes are needed: the tracking script reads the contact fields when a form is submitted.
- What is read: email, phone, name, company, message and country, recognised by field type,
autocomplete, name and label. Optionally the other answers too (service, budget, ...). - Never read: passwords, hidden and file inputs, payment and one-time-code fields, anything named like a card number, token or captcha, and card-number-like values. Forms with a password field (login/signup) and search forms are skipped.
- Opt a form or field out: add
data-lf-ignore. In "only marked forms" mode, adddata-lf-captureto the forms you want. - WhatsApp opt-in: a checkbox whose label mentions WhatsApp is recorded as the contact's opt-in.
- Ad clicks: Google Ads (
gclid,gbraid,wbraid) and Meta (fbclid) click IDs in the landing page address are saved on the contact exactly as received, so you can see which ad brought a lead and report bookings and sales back to Google Ads with an automation.
window.lf.lead({
email: 'jane@example.com',
phone: '+44 7911 123456',
name: 'Jane Doe',
message: 'Do you have parking?',
form: 'chat-widget', // shown as the form name
service: 'Yoga' // any other key is kept as a custom field
});
curl -X POST https://leadfnf.com/api/v1/contacts \
-H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"site_id":"YOUR_SITE_UUID","email":"jane@example.com","name":"Jane Doe",
"session_uuid":"(optional, links the visit)","source_label":"crm-sync",
"gclid":"(optional, the Google Ads click ID your form collected)",
"ad_click_at":"(optional, ISO 8601 time of the click)"}'
# => {"ok": true, "contact": {"uuid": "..."}, "session_matched": true}
# Click IDs: gclid, gbraid, wbraid or fbclid, up to 255 characters, passed on exactly as received.
# A click older than 90 days is ignored (ad networks no longer accept it).
GDPR & consent
- You are the controller of the contact details your visitors submit; LeadFnF is your processor. Say so in your privacy policy next to the form.
- "Recognise returning leads" stores a first-party ID in the visitor's browser after they submit a form. Leave it off, or require consent-banner acceptance, if your jurisdiction needs consent for that.
- Ad click IDs are always read from the page the visitor lands on. Keeping one in the visitor's browser for later visits (up to 90 days) only happens after they accept the LeadFnF consent banner, or when you tick "Credit ad clicks from earlier visits" because your site already asks for consent. When reported to Google Ads, only the click ID, the time and the value are sent, never names, emails or phone numbers.
- Access and erasure: export a contact's data or delete them permanently (with their submissions) from the contact page.
Booking Calendars FnF Connect add-on
Create a calendar under FnF Connect → Calendars, set your weekly hours, and share the booking link or embed it. Invitees get a confirmation with a calendar invite, reminders, and links to reschedule or cancel. Connect Google Calendar so your busy times block bookings and every booking appears in Google (with a Meet link if you choose Google Meet).
<div data-lf-calendar="YOUR-CALENDAR-SLUG"></div> <script src="https://leadfnf.com/js/lf-book.js" defer></script> <!-- or a button that opens it in a popup --> <div data-lf-calendar="YOUR-CALENDAR-SLUG" data-mode="popup" data-label="Book a free call"></div>
- With the LeadFnF tracker on the same page, each booking is linked to the visitor's session, so the contact shows the source, campaign and pages that led to the booking.
- The page's UTM tags are passed into the booking.
- Listen for
lf:bookedon the element (event.detail.bookingis the booking id) to fire your own conversion tags. - Goals and funnels can use the "Booking made" event (
lc_booking_created).
Automation Webhooks FnF Connect add-on
Add a Send a webhook step to an automation to POST the contact (and booking, if there is one) as JSON to Zapier, Make, your CRM or your own server. Only https:// URLs on the public internet are allowed; a non-2xx answer retries after 1, 5 and 30 minutes.
Every request carries X-LeadFnF-Signature: t=<unix time>,v1=<hex>, an HMAC-SHA256 of t + "." + raw body with the automation's secret (shown in the webhook step). Verify it, and reject timestamps older than 5 minutes:
$body = file_get_contents('php://input');
preg_match('/^t=(\d+),v1=([0-9a-f]{64})$/', $_SERVER['HTTP_X_LEADFNF_SIGNATURE'] ?? '', $m);
$ok = $m && abs(time() - (int) $m[1]) < 300
&& hash_equals(hash_hmac('sha256', $m[1] . '.' . $body, $secret), $m[2]);
$event = json_decode($body, true); // $event['contact']['email'], ['booking'], ['test']
- Payload:
id,event,test,automation,contact(name, email, phone, stage, tags, source, campaign) andbooking. - Use
idto ignore a delivery you've already processed: retries of the same step send the same id. - The builder's Test button sends a real request marked
"test": true.
Webhook Trigger FnF Connect add-on
Start one automation from any form or app. Choose A webhook is received as the automation's trigger and it gets a private URL. Each request creates or updates the contact (source webhook) and starts that automation only; it doesn't start your "A form is submitted" automations.
curl -X POST https://leadfnf.com/api/v1/hooks/<your token> \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: order-1234' \
-d '{"name": "Sam Patel", "email": "sam@example.com", "phone": "+44 7700 900123",
"message": "Quote please", "budget": "2500", "gclid": "Cj0KCQ..."}'
- POST or PUT with JSON (an object, or a list holding one object), form-encoded or multipart fields. Up to 64 KB; nested data is fine (
data.contact.email). - Fields are picked up automatically by common names (email, phone, mobile, name, first_name, last_name, company, message, country, gclid, utm_source…). Use Listen for a test request in the builder to map anything else, or keep extra values as custom fields you can use in steps as
{webhook.budget}. - An email or phone is required. WhatsApp and text consent count only from explicit fields (
whatsapp_opt_in,sms_opt_in). Google and Meta click IDs (gclid,gbraid,wbraid,fbclid) are stored exactly as sent. - Responses:
202{"ok":true,"processed":true,"contact":{"uuid":"…"},"started":true};200duplicate (same body within 10 minutes);422witherror(no_identifier,spam,invalid_json…);401wrong secret;404unknown URL;413,415,429. - Retries: send an
Idempotency-Key(orX-Request-Id) header and a retry within 24 hours gets the first answer back. - Optional: require an
X-FnF-Secretheader (set in the builder) for requests from servers you control. "Make a new URL" stops the old one at once. - While the automation is a draft or paused, requests are only kept as a test sample: no contact is created.
Privacy & GDPR
LeadFnF is designed to work without cookies and without requiring a consent banner in most jurisdictions.