ConverlayConverlay

Quick Start

Get tracking running in under 2 minutes. Choose your approach below.

Vanilla JavaScript

Import and initialize createConverlay, then call track() for each event.

tracking.ts
import { createConverlay } from '@converlay/sdk'

const converlay = createConverlay({
  shopDomain: 'my-store.myshopify.com',
  autoPageView: true,
  debug: true,
})

// Track a product view
converlay.track('view_item', {
  ecommerce: {
    items: [{
      item_id: 'SKU-001',
      item_name: 'Classic Tee',
      price: 29.99,
      quantity: 1,
    }],
  },
})

// Track a purchase
converlay.track('purchase', {
  ecommerce: {
    transaction_id: 'ORD-5678',
    value: 59.98,
    currency: 'USD',
    items: [
      { item_id: 'SKU-001', item_name: 'Classic Tee', price: 29.99, quantity: 2 },
    ],
  },
  userData: {
    email: 'customer@example.com',
  },
})

React

Wrap your app with ConverlayProvider and use the useConverlay() hook in any component.

App.tsx
'use client'

import { ConverlayProvider, useConverlay } from '@converlay/sdk/react'

// Wrap your app
export default function App({ children }) {
  return (
    <ConverlayProvider
      shopDomain="my-store.myshopify.com"
      autoPageView={true}
    >
      {children}
    </ConverlayProvider>
  )
}

// Use in any component
function AddToCartButton({ product }) {
  const { track } = useConverlay()

  return (
    <button onClick={() => {
      track('add_to_cart', {
        ecommerce: {
          items: [{
            item_id: product.id,
            item_name: product.title,
            price: product.price,
            quantity: 1,
          }],
        },
      })
    }}>
      Add to Cart
    </button>
  )
}

What happens next

  1. The SDK generates a persistent client_id and manages 30-minute sessions via localStorage
  2. UTM parameters and click IDs (gclid, fbclid, ttclid) are captured automatically
  3. Events are sent to Converlay's collection endpoint via sendBeacon (with fetch fallback)
  4. Converlay forwards events server-to-server to your connected destinations (GA4, Meta, TikTok, etc.)

Next steps