Tracking script

Goals

Add data-df-goal="name" to any element, or call window.datafair('goal', 'name', { plan: "pro" }). Extra attributes like data-df-goal-plan="pro" become properties.

Identify a customer

window.datafair('identify', { user_id, email, name }). Only send what your privacy notice covers.

Passing the visitor to checkout

window.datafair.attribution() returns df_visitor_id and df_session_id. Put them in your checkout's metadata. Links to Stripe payment links, Dodo Payments, Lemon Squeezy, Creem and Gumroad checkouts are tagged automatically.

Privacy controls

Cookieless mode

Add data-cookieless to the script tag and nothing is stored in your visitors' browsers: no cookies and no local storage. DataFair works out a visitor id from a keyed hash of the day, your website, the visitor's IP address and their browser's user agent. The IP address itself is never stored, and the hash can't be turned back into it.

Options

Documentation