Important note: If you're using our Shopify app, Ecommerce properties are available out-of-the-box. You don’t need this guide.

What are Ecommerce properties?

Ecommerce properties help you refine your targeting by sharing additional details about your visitors with Wisp. These details include the cart value, the stock of the item being viewed, etc.

How to set up Ecommerce properties on your store

Step 1: Update your Wisp script

Take the script you used when you set up your website. It should look like this:

<script>
(function(w,i,s,p){a=document.createElement("script");a.src=w+"/embed?website_id="+i;a.onload=function(){wisp.start(w,i,s,p);};document.head.appendChild(a);})
("https://app.getwisp.co", "WEBSITE_ID");
</script>

Add a new parameter at the end of the script to provide the properties

<script>
(function(w,i,s,p){a=document.createElement("script");a.src=w+"/embed?website_id="+i;a.onload=function(){wisp.start(w,i,s,p);};document.head.appendChild(a);})
("https://app.getwisp.co", "WEBSITE_ID", {
property1: 'value',
property2: 1
});
</script>

Step 2: Fill the last parameter with the properties

{
client_id: 'REPLACE_WITH_YOUR_INTERNAL_ID',
cart: {
value: 134,
},
product: {
stock: 5,
},
}

Here is a list of the properties you can provide:

  • client_id : Used to identify a visitor across different devices
  • accepts_marketing : Used to know if a visitor has accepted to receive marketing emails or not
  • cart.value : Current value of the cart
  • product.stock : Stock of the product the user is currently seeing
  • orders[].date : Date when the last order was made
  • orders[].items[].id : ID of the bought item
  • orders[].items[].sku : Sku of the bought item

Don't hesitate to reach out to us if you need additional properties.

Step 3: Dynamically update Wisp

If an event happens before the page reloads and you need to update Wisp, you can call the updateContext function. When calling this function, Wisp will try to get other notifications.

Example:

window.wisp.updateContext({
cart: {
value: 134,
},
});

Did this answer your question?