This topic explains how to create a Shopify Custom Pixel that reports checkout events to LaunchDarkly. It uses the JavaScript SDK’s track and Shopify’s analytics.subscribe methods to capture checkout_started and checkout_completed events and report them to LaunchDarkly.

To learn more about the LaunchDarkly JavaScript SDK before you get started, read JavaScript SDK reference guide.
To learn how to configure a Shopify Custom Pixel, read Shopify’s documentation.
Here is an example of code to configure a Shopify Custom Pixel that reports checkout events to LaunchDarkly. Depending on your specific implementation, you may need to modify the code to better fit your needs.
This code:
waitForClient(fn) to poll until ldClient.track existscheckout_started and checkout_completedtrack()Here’s how:

If you decide to modify the code above, we recommend the following best practices:
LDClient.initialize(). Using <script async> tags may result in errors.If you have unexpected results, remember that Shopify’s analytics.subscribe fires as soon as the Pixel sandbox starts, which can be before the LaunchDarklySDK script has parsed.
