Connect visitor data with JS SDK

Including Enhencer script

To start, copy the code below and paste it in the <head> element of every page.

<script src='{this.state.userId}'></script>

Listing page function

Add the function below to the loading/opening function of product listing pages.

    listingCategory: {listing category goes here}

Pass the category string to the function with slashes in-between. For example, 'shoes/men/outdoor'.

Product page function

For product detail pages, add the function below to the loading/opening function of your product detail pages.

    productID: {product id goes here},
    productCategory: {product category goes here},
    price: {product price goes here}

Add to cart function

When a product is added to the cart, call the function below with the ID of the product that's added.

    productID: {product id goes here}

Purchase function

Call the function below when a purchase completed successfully. Pass the purchase products array as a parameter. Every product has to have id, price and quantity parameters at least.

    products: {purchase products goes here}

Example for a 'purchaseProducts' variable would be:
[{id: 'lw-154', price: 89, quantity: 2}, {id: 'lw-301', price: 45, quantity: 1}]