Afflixo integration demo

This page demonstrates two separate products you can use on your storefront. They do not depend on each other: you may install only the affiliate SDK, only live chat, or both.

A — Referral & conversions Load sdk.js for click tracking, ?ref= cookies, and trackConversion. Uses window.Affiliate. Sections A1–A3 below.
B — Live chat Load chat-widget.js with data-merchant-id for the visitor chat bubble. Not part of the SDK — no Affiliate API. Section B1 below. Full guide: Live chat docs.

Part A — Affiliate (Afflixo SDK)

A1. Script included (sdk.js)

Affiliate integration only: add this in your <head> (script loads from current origin — e.g. this page’s domain — so it works locally and in production). This is not the live chat script.

Loading…

Checking…

A2. Referral link

Visitors arriving with ?ref=CODE or /ref=CODE get a cookie set. Current affiliate code from cookie:

A3. Report conversion (demo)

Conversions need an affiliate. Normally the visitor arrives via ?ref=CODE and the cookie is set; here you can enter an affiliate code to test without a referral visit (get a code from the merchant’s affiliate dashboard).

Affiliate code (optional — from cookie if you came via ?ref=CODE, or type one to test):

Parameters: orderId, amount (required); currency, affiliateCode, transactionId, email, productName, note (optional). Copy to your order confirmation page:

if (window.Affiliate.getAffiliateCode()) {
  window.Affiliate.trackConversion({
    orderId: 'YOUR_ORDER_ID',   // required
    amount: 99,                 // required (number)
    currency: 'USD',            // optional, default 'USD'
    affiliateCode: undefined,  // optional, uses cookie if omitted
    transactionId: undefined,   // optional
    email: undefined,           // optional
    productName: undefined,     // optional
    note: undefined             // optional, max 1000 chars
  })
    .then(function() { /* success */ })
    .catch(function(err) { console.warn('Conversion track failed', err); });
}

Part B — Live chat (standalone widget)

B1. Live chat widget (chat-widget.js)

Separate from Part A. Live chat does not use sdk.js or window.Affiliate. On your real site you add a second script tag only if you want the chat bubble. Use your merchant slug as data-merchant-id (same slug you use in /sdk.js?merchant= when you run both features).

This demo page reuses ?merchant= only for convenience, then verifies the slug via /api/integration-demo/chat-embed before injecting the widget (same production script and rules: live chat on, allowed domains, page rules, device visibility).

Loading…

Loading chat widget…

See Live chat integration guide for allowed domains, dashboard settings, and optional data-api-base.