Tracking conversions and custom events in a headless setup

Setup and events
We’re running a headless webshop (NextJS + Shopify) and are trying to implement correct builder.io tracking, so we’re able to see basic conversion data for each landing page under insights.

We would like to track the following events

  • Conversions
    • Shopify checkout
    • Custom checkout
  • Add to cart

We were able to track the conversion in the Shopify checkout by appending the sessionId in the checkout url.
https://www.builder.io/c/docs/conversion-tracking

We also have a custom react checkout in which we would like to track the conversions. In the docs I see we can use the @builder.io/sdk package and track the conversion using builder.trackConversion(...);

After a lot of trial and error, we can see some conversion events coming in, but a lot of them are being ignored. To clarify the implementation, it would help having some answers on the following questions:

  • How will the the conversion event be linked to the builder.io landing page? Do we have to send the contentId ourselves, or will builder.io handle this by using the sessionId? Does builder.io remember visitors that visited the landing page, and so assign that conversion to that landing page?
  • The same questions goes for our custom product-added event. This event doesn’t seem to be assigned to the insights of a specific landing page. Do we have to send some additional data to builder.io, or should builder.io handle this by using the sessionId?
  • Can a user send multiple conversion events in the same session? In other words, if the user refreshes their page, will it add another conversion in the insights? We found a cookie is set in the Shopify checkout to prevent double tracking, but what about the custom trackConversion event?
  • What will happen when we send the trackConversion/custom event without a user has visited a builder.io landing page? Will the event be ignored?

Example of conversion event using the Shopify checkout

Example of conversion event using our custom checkout

Hi @viktor_ec thank you for the question! I recommend checking out this doc: Builder vs. Shopify Conversions - Builder.io

Which explains how we reference session IDs to assign tracking of conversion to an associated content block. The information outlined in this doc specifically mentions conversions, but also holds true of other tracking events, such as clicks and impressions, and even your custom tracking events.

Hopefully that adds some clarity, please let me know if there are any further questions we can assist you with!