Purchase Tracking (Optional)

Connect confirmed orders to LiftSell when you are ready to measure revenue

Your widgets, views, and clicks work without purchase tracking. For basic setup, use the widget installation guide. No checkout or thank-you page is needed for that step.

This guide covers the optional connection to confirmed order data. Shopify uses the LiftSell Purchase Tracking extension when available in your installed app. Other platforms need an integration that can run after an order is confirmed and after LiftSell has loaded. A developer may be needed. Revenue reporting depends on your LiftSell plan.

1. Requirements

Before setting up optional purchase tracking:

  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

    Connect confirmed order data

    For a custom integration, your order confirmation flow must allow purchase tracking code. Shopify uses the extension described below instead. This access is not required for basic widget installation.

2. Widget Script (Custom Integrations)

For custom integrations, load the widget script on pages where you display the widget, and in the supported order confirmation flow where you call the tracking API:

  • Homepage & product pages (for views & clicks)
  • Other pages where you want the widget to appear
  • 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>
  • WooCommerce / Webflow / other site builders → in a supported custom code area. Shopify app installations use the app embed and checkout extension below.

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
  • For custom integrations, LiftSell must be loaded before you call this function. Optional chaining silently skips the call if it is not ready.
  • 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

First install LiftSell and enable its app embed in your theme editor, then click Save. This installs storefront widgets without editing theme files. Storefront installation does not require purchase tracking.

For optional purchase tracking, use the LiftSell Purchase Tracking extension, if it is available in your installed app:

  1. In Shopify admin, open Settings → Checkout → Customize.
  2. Choose the Thank you page and enable the LiftSell Purchase Tracking extension where it is offered.
  3. Save, then validate a test order through the complete checkout flow. Confirm the order appears in LiftSell metrics.

If the extension is not listed, contact LiftSell support to check availability. You can continue using storefront widgets while this optional setup is pending.

Do not use legacy Additional scripts instructions. The current Shopify checkout uses extensions; see Shopify's upgrade guide.

Custom or headless storefronts need their own integration. Theme app embeds do not install widgets into a separate frontend.

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. Optional Purchase Tracking Test

After basic widget installation works, validate the optional purchase integration:

  1. Set up the Shopify purchase tracking extension or your platform's custom purchase integration
  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 extension or custom tracking function should report the confirmed order 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 Shopify extension is enabled, or your custom integration calls trackPurchase after LiftSell loads
  • For custom integrations, the embed script is present on the confirmation 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.