Mable-Headless
Mable-Headless is a custom flavour of Mable's tracking which brings support for headless and custom setups. This package provides types and utility functions to help you integrate Mable's tracking into your project and get higher conversion rates.
Installation
npm install @mableai/headless
Usage
Basic usage
import { loadScript, MableEventName } from '@mableai/headless'
// Load the script ( you can directly load by script tag too )
await loadScript(
'https://imon-dev.mable.ai/static/scripts/dist/swhdls.bundle.js'
)
// track a pageview
await window.wgs?.track(MableEventName.PageView, {})
Events
Event Name (MableEventName ) |
Description | Payload Type |
---|---|---|
PageView |
tracks page view | IMableBaseData |
CollectionView |
tracks product collection/navigation view | IMableBaseData & IMableCollectionRelatedData |
ProductView |
tracks product view | IMableBaseData & IMableProductRelatedData |
CartModified |
Tracks modification to cart data | IMableBaseData & IMableCartRelatedData |
CartView |
Tracks cart view | IMableBaseData & IMableCartRelatedData |
CheckoutStart |
Tracks checkout start | IMableBaseData & IMableCheckoutRelatedData |
PaymentInfoEnter |
Tracks payment info enter | IMableBaseData & IMableCheckoutRelatedData |
OrderPlaced |
Tracks order placed | IMableBaseData & IMableCheckoutRelatedData |
Lead |
Tracks lead | IMableBaseData & IMableLeadRelatedData |