How do you send custom events to Instant Audiences?

Sending custom events to the Audiences pixel is easy to setup.

If you are looking to integrate Audiences into a headless store, please proceed here.

This guide will walk through how you can send custom events to Instant Audiences.

It is common that even while using Instant's native integrations into platforms like Shopify and BigCommerce, that modifications to a product page, such as dynamic DOM rendering (without refreshing the page) may result in the native integration not sending through event such as product viewed, or add to cart events.

You may also want to track additional add to cart events from upsell pop-ups, or other locations that are custom built and not picked up by our native integrations.

Please contact your customer success manager if you run into any issues - we are happy to guide you or your developers through this implementation.

Steps to send custom events to Audiences:

To send custom events to Audiences, please complete the following:

  1. Locate where you would like to send a custom event to Audiences. 
  2. Copy and paste the below snippet of code to the location to where you'd like to send the custom event.
window.InstantJS.track("EVENT_TYPE", [{
    provider: "KLAVIYO",
  event: EVENT_DATA
}]);
  • Replace EVENT_TYPE with the type of event you wish to send.
  • Replace EVENT_DATA with the data you'd like to send to Audiences. Audiences will then send this data through to your marketing integrations such as Klaviyo.

Note that the available events are as follows:

  • PAGE_VIEWED, COLLECTION_VIEWED, PRODUCT_VIEWED, ITEM_ADDED_TO_CART, CART_VIEWED, CHECKOUT_STARTED, CHECKOUT_ADDED_PAYMENT_INFO, CHECKOUT_ADDED_ADDRESS_INFO, PURCHASE_COMPLETED

Examples:

Example #1: Klaviyo Viewed Product: If you render your product page dynamically (which may interfere with Shopify customer event tracking), then you can send a product viewed event to Audiences directly. See below for an example. 

window.InstantJS.track("PRODUCT_VIEWED", [{
    provider: "KLAVIYO",
    event: {
      ProductName: "Expandable Bag",
        ProductID: "12345",
      Categories: ["Bags"],
      URL: "https://example.com/product/expandable-bag",
      Brand: "YourBrand",
      Price: "$199.99",
      CompareAtPrice: "$249.99",
        ImageURL: "https://example.com/images/expandable-carry-on.jpg"
    }
}]);