{"entries":[{"name":"identify","kind":"method","since":"2.1","signature":"convertflow.identify(data, callback)","description":"Attaches an email or phone plus profile and custom fields to the current visitor for identity resolution. Also pre-fills form fields and personalizes merge tags. Preset fields: email, phone, name, last_name, company_name, company_title, url, state, city, country, zip_code, address. Anything under custom_fields is stored as a custom field by slug. Re-runs campaign targeting once the library is ready.","example":"convertflow.identify({\n  email: 'jane@example.com',\n  name: 'Jane',\n  custom_fields: { plan: 'pro' }\n}, function () {\n  console.log('identified');\n});"},{"name":"load","kind":"method","since":"2.1","signature":"convertflow.load({ cta_id, callback })","description":"Loads a campaign into the page without displaying it, so a later trigger can show it instantly. Injects a hidden embed container for the campaign.","example":"convertflow.load({ cta_id: 12345 });"},{"name":"trigger","kind":"method","since":"2.1","signature":"convertflow.trigger({ cta_id, step })","description":"Displays a campaign you already loaded. Pass step (a step position) to jump the visitor's variant to that step.","example":"convertflow.trigger({ cta_id: 12345, step: 2 });"},{"name":"start","kind":"method","since":"2.1","signature":"convertflow.start()","description":"Resets all campaigns, then re-runs visitor tracking and targeting conditions. Call it after a client-side navigation, or after you change data that targeting depends on.","example":"convertflow.start();"},{"name":"close","kind":"method","since":"2.1","signature":"convertflow.close({ cta_id, track })","description":"Closes visible popup, hook, sticky bar, and two-tap campaigns. With no argument, it closes all of them. Pass cta_id to close one, and track: true to record the close.","example":"convertflow.close({ cta_id: 12345 });"},{"name":"trackPurchase","kind":"method","since":"2.2","signature":"convertflow.trackPurchase({ revenue, order_id, currency })","description":"Records a purchase (order conversion) for the current visitor, once per session per order. revenue is a number in major units, and order_id is a string or number of 1 to 100 characters. Not available on earlier library versions.","example":"convertflow.trackPurchase({\n  revenue: 49.99,\n  order_id: 'ORDER-1001',\n  currency: 'USD'\n});"},{"name":"validations","kind":"method","since":"2.1","signature":"convertflow.validations({ fieldKey: fn })","description":"Registers custom form-field validators, keyed by field slug. Each function receives the field value and returns true when the value is valid, or an error message string to block submission.","example":"convertflow.validations({\n  vat_number: function (value) {\n    return /^[A-Z]{2}\\d{8,12}$/.test(value) || 'Enter a valid VAT number';\n  }\n});"},{"name":"person","kind":"property","since":"2.1","type":"object","description":"The current visitor or contact profile: visitor_token, contact fields (email, phone, name, and so on), custom fields under extra, and tracking data. It populates asynchronously, so it stays undefined until the cfReady event fires."},{"name":"cart","kind":"property","since":"2.1","type":"object","description":"Live Shopify cart snapshot: { value, count } (value in major units). On the 2.2 library it also tracks orders by order id. Shopify stores only."},{"name":"product","kind":"property","since":"2.1","type":"object","description":"The Shopify product of the current product page: { id, title, type, price, compare_at_price, description }. Shopify stores only."},{"name":"session","kind":"property","since":"2.2","type":"object","description":"The visitor's current session: page count, visited urls with timestamps, UTM attribution, and a newSession flag. It's empty until the library initializes session tracking."},{"name":"events","kind":"property","since":"2.1","type":"array","description":"Append-only log of every ConvertFlow event fired on this page view, in order. Each entry is the same payload handed to event listeners."},{"name":"ctas","kind":"property","since":"2.1","type":"object","description":"Registry of loaded campaigns, keyed by campaign id. Advanced: it's mostly useful for inspecting which campaigns the library has loaded."},{"name":"platform","kind":"property","since":"2.1","type":"string","description":"Set this before the library boots to override the visitor's platform value (it defaults to \"Web\"). Some earlier library versions read it; the current library detects the platform itself and ignores it."},{"name":"cfReady","kind":"event","since":"2.1","description":"The library finished loading the visitor and running targeting. convertflow.person is available from this point on. No payload.","example":"window.addEventListener('cfReady', function () {\n  console.log(convertflow.person);\n});"},{"name":"cfView","kind":"event","since":"2.1","description":"A campaign or step was displayed to the visitor."},{"name":"cfSubmit","kind":"event","since":"2.1","description":"A form, survey, or quiz was submitted. The payload's fields object carries the submitted values.","example":"window.addEventListener('cfSubmit', function (e) {\n  console.log(e.detail.cta, e.detail.fields);\n});"},{"name":"cfConversion","kind":"event","since":"2.1","description":"A visitor converted on a campaign button or element."},{"name":"cfCompletion","kind":"event","since":"2.1","description":"A visitor completed a campaign by reaching its completion step or action."},{"name":"cfClose","kind":"event","since":"2.1","description":"A campaign was closed. The payload carries the campaign and variant only, with no step or element."},{"name":"cfAddToCart","kind":"event","since":"2.1","description":"A product was added to the cart through a ConvertFlow products element. The payload includes product details."},{"name":"cfAnswer","kind":"event","since":"2.2","description":"A quiz question was answered. It fires for every question, including the last one. The payload's fields.extra object maps question slugs to answers."},{"name":"cfAddToCartShopify","kind":"event","since":"2.1","description":"The native Shopify cart received an item (an intercepted /cart/add.js call, from any script on the page). No payload, so read convertflow.cart."},{"name":"cfUpdateCartShopify","kind":"event","since":"2.1","description":"The native Shopify cart was updated (/cart/update.js). No payload, so read convertflow.cart."},{"name":"cfChangeCartShopify","kind":"event","since":"2.1","description":"A native Shopify cart line changed (/cart/change.js). No payload, so read convertflow.cart."},{"name":"cfClearCartShopify","kind":"event","since":"2.1","description":"The native Shopify cart was cleared (/cart/clear.js). No payload, so read convertflow.cart."}]}