Conversion (purchase) event tracking

How to track purchase conversion events and fire custom scripts when transactions occur

What is conversion event tracking?

Conversion (purchase) event tracking records when customers complete a transaction. This allows you to measure sales performance and fire custom scripts when purchases occur.

How do I track conversion events?

You can use the following script as a starting point. If you're not familiar with JavaScript, we recommend working with a developer to help you set up the script. We also offer paid technical support; get in touch via the support chat.

The following script should be added to your own website, on each page where you have added your checkout and the customer will make the purchase.

<script type="text/javascript">
 window.addEventListener("message", function (event) {

   // check if event is from Checkout Page
   if (event.data.type && event.data.type === "checkoutpage.event") {
     
     // check if event is a checkout (purchase) event
     if (event.data.payload.event === "checkout") {
       // track purchase event here
       console.log(event.data.payload);
     }
   }
 });
</script>

The event.data.payload contains the following data:

  • event: "checkout"
  • checkoutId: the ID of your checkout
  • orderId: the ID of your customer's order
  • customerEmail: your customer's email address
  • value: the final purchase amount
  • currency: the currency of the purchase

On this page