Installation & Purchase Tracking

Complete guide to install LiftSell and track purchases for revenue attribution

LiftSell works on any website where you can:

  1. Inject a small <script> tag (the embed snippet), and
  2. Run a short JavaScript snippet on your checkout success / thank-you page.

Once installed, LiftSell tracks:

  • Views – when a widget is shown
  • Clicks – when a visitor interacts with the widget's CTA
  • Purchases – when an order is completed

and attributes revenue back to the widgets that actually influenced the sale.

1. Requirements

Before installing LiftSell on any platform:

  1. 1

    Create a Site

    Go to Sites → Add site and enter your store domain (e.g. myshop.myshopify.com, shop.mydomain.com). Complete domain verification if required.

  2. 2

    Create at least one widget

    Create an announcement bar, free shipping bar, sticky ATC, etc. Open the widget and copy its embed script (public key).

  3. 3

    Ensure thank-you page access

    Make sure your store has a thank-you / order success page where you can inject custom scripts.

2. Global Embed Script (All Platforms)

The embed script must be loaded on all public pages, especially:

  • Homepage & product pages (for views & clicks)
  • Cart & checkout
  • Order success / thank-you page (for purchase tracking)
<script src="https://www.liftsell.com/embed/ls_YOUR_PUBLIC_KEY" async ></script>

Recommended placements:

  • Plain HTML / custom sites → in the main layout, before </body>
  • Next.js / React → in your root layout or _app via <Script>
  • Shopify / WooCommerce / Webflow / etc. → in the global theme header or custom code area

Note: You can embed multiple widgets on the same site. Each widget has its own ls_... public key, but they all share the same tracking + attribution system.

3. Purchase Tracking (Required for Revenue Attribution)

To attribute revenue to widgets, LiftSell must know when an order has been completed.

On your order success / thank-you page, call:

<script> window.LiftSell?.trackPurchase({ order_id: "ORDER-12345", // unique order identifier revenue: 49.90, // net order value (number, not string) currency: "EUR", // optional, but recommended (e.g. USD, TRY) }); </script>

LiftSell will automatically:

  • Attach the correct session ID
  • Include current URL, referrer and UTM parameters
  • Log a purchase event in the usage_events table
  • Attribute the order to the last widget click (or view) in the last 7 days

Rules:

  • Call trackPurchase exactly once per order
  • The embed script must also be present on the thank-you page
  • If you use an SPA / headless frontend, make sure trackPurchase runs after the order is confirmed

4. Platform Guides

4.1 Generic HTML / Custom Websites

Step 1 – Embed Script

In your main HTML layout, add:

<script src="https://www.liftsell.com/embed/ls_YOUR_PUBLIC_KEY" async ></script>

Step 2 – Purchase Event

On your order success / thank-you template:

<script> window.LiftSell?.trackPurchase({ order_id: "{{ORDER_ID}}", revenue: {{ORDER_TOTAL}}, currency: "{{ORDER_CURRENCY}}", }); </script>

Replace the placeholders with your templating variables (e.g. Blade, Twig, EJS, etc.).

4.2 Shopify

4.2.1 Add the Embed Script (Theme-wide)

  1. Go to Online Store → Themes → Edit code
  2. Open theme.liquid (or your main layout file)
  3. Add, before </body>:
<script src="https://www.liftsell.com/embed/ls_YOUR_PUBLIC_KEY" async ></script>

This loads LiftSell on all storefront pages (homepage, product pages, cart).

4.2.2 Track Purchases on the Order Status Page

The Order status page is a separate Shopify-hosted page and does not load your theme. You must add both the embed script and the trackPurchase snippet in the same place:

  1. Go to Settings → Checkout → Order status page → Additional scripts
  2. Paste first the embed script, then the trackPurchase snippet below:
<script src="https://www.liftsell.com/embed/ls_YOUR_PUBLIC_KEY" async ></script><script> window.LiftSell?.trackPurchase({ order_id: "{{ order.order_number }}", revenue: {{ order.total_price | divided_by: 100.0 }}, currency: "{{ order.currency_code }}", }); </script>

Important: If you only add the trackPurchase snippet, window.LiftSell will be undefined on the Order status page and tracking will not run. Always include the embed script there as well.

Notes:

  • order.order_number is the order number (e.g. 1001)
  • order.total_price is in cents in Shopify; divided_by: 100.0 converts it to a decimal (e.g. 4990 → 49.90)
  • order.currency_code is the ISO currency code (e.g. USD, EUR)

4.3 WooCommerce / WordPress

4.3.1 Add the Embed Script

Option A – Theme header (header.php):

<script src="https://www.liftsell.com/embed/ls_YOUR_PUBLIC_KEY" async ></script>

Place it before </head> or </body>.

Option B – Header/footer plugin:

Use any "Header & Footer Scripts" plugin and paste the same <script> into the global header section.

4.3.2 Track Purchases via WooCommerce Hook

Add this to functions.php (or a small custom plugin):

add_action('woocommerce_thankyou', function($order_id) { if (!$order_id) return; $order = wc_get_order($order_id); if (!$order) return; ?> <script> window.LiftSell?.trackPurchase({ order_id: "<?php echo esc_js($order->get_order_number()); ?>", revenue: <?php echo floatval($order->get_total()); ?>, currency: "<?php echo esc_js($order->get_currency()); ?>", }); </script> <?php });

Notes:

  • This hook runs on the thank-you page, once per order
  • get_order_number() returns the human-readable order number (e.g. #1001)
  • get_total() returns the order total as a float (no esc_js() needed for numbers)
  • Make sure the embed script is also loaded on the thank-you page (via header.php or a header/footer plugin)

4.4 Next.js / React SPA / Headless Frontends

Embed Script (Global)

In Next.js, for example in app/layout.tsx or _app.tsx:

import Script from "next/script"; export default function RootLayout({ children }) { return ( <html> <body> {children} <Script src="https://www.liftsell.com/embed/ls_YOUR_PUBLIC_KEY" strategy="afterInteractive" /> </body> </html> ); }

Purchase Tracking (Order Confirmation Route)

In your order confirmation page / component:

import { useEffect } from "react"; export default function OrderSuccessPage({ order }) { useEffect(() => { if (typeof window !== "undefined") { window.LiftSell?.trackPurchase({ order_id: order.id, revenue: order.total, currency: order.currency || "EUR", }); } }, [order?.id]); return <div>Thank you for your order!</div>; }

The important part is that trackPurchase runs client-side after the order is confirmed.

4.5 Webflow, Wix, Squarespace and Other Builders

These platforms typically offer:

  • Global custom code (head/footer)
  • Checkout / order confirmation custom code

Global Embed:

Paste the embed <script> into your site-wide custom code (usually head or footer).

Purchase Tracking:

In the checkout / order confirmation custom code area, add:

<script> window.LiftSell?.trackPurchase({ order_id: "{{ORDER_ID}}", <!-- Use platform's variables --> revenue: {{ORDER_TOTAL}}, currency: "{{ORDER_CURRENCY}}", }); </script>

Consult your platform's docs to find the correct order variables. For Wix, add the snippet to your Thank You / Order Confirmation page (via Velo or Custom Code) and replace the placeholders with real order ID, total, and currency from Wix Stores (e.g. from the order confirmation context or Velo APIs).

5. How Attribution Works

Once views, clicks and purchases are being tracked, LiftSell will:

  • For each purchase event:
    • Look back 7 days in the same session_id
    • Find the last widget_click event
    • If there is no click, fall back to the last widget_view
    • Attribute the full order value to that widget (last-touch model)
  • Aggregate everything daily into widget_metrics_daily, which powers:
    • Views, Clicks, Orders, Revenue
    • Click rate, order rate, revenue per view

You can see these metrics on the Metrics tab on each widget, and in the Analytics section.

6. Quick Integration Test

To confirm everything works:

  1. Install the embed script + trackPurchase snippet for your platform
  2. Create a test widget (e.g. free shipping bar) and make sure it shows on your site
  3. Open your store in a clean browser session
  4. See the widget → a widget_view event should be logged
  5. Click the CTA → a widget_click event should be logged
  6. Place a test order until the thank-you page
  7. The trackPurchase snippet should run once
  8. A purchase event should be logged
  9. Go to the widget's Metrics tab:
    • You should see at least: 1 view, 1 click, 1 order, some revenue

If views / clicks appear but orders do not, double-check:

  • The thank-you page actually runs trackPurchase
  • The embed script is present on that page
  • No ad-blocker is blocking the embed domain

7. Privacy & Legal

LiftSell is a first-party, self-hosted measurement script that helps you track widget performance and revenue attribution.

What We Track

LiftSell collects anonymous data for measurement purposes:

  • Anonymous session ID (stored in localStorage/cookie)
  • Page views (URL, referrer, UTM parameters)
  • Widget views & clicks
  • Purchase events (order ID, revenue, currency)
  • Anonymized IP address and country (for fraud prevention)

Legal Basis (GDPR)

Under GDPR, LiftSell operates under "legitimate interest" for conversion tracking and revenue attribution. This is a standard legal basis for analytics and measurement tools.

Your Responsibility

You should:

  • Reference LiftSell in your privacy policy as a measurement/analytics service
  • Inform users that you use a first-party script for conversion tracking
  • Comply with applicable privacy laws in your jurisdiction (GDPR, CCPA, etc.)

Important: LiftSell is a first-party script (hosted on your domain via embed). We do not use third-party tracking pixels or cookies.