Instrument Pixel

This example demonstrates how to instrument the pixel across a simple storefront. This includes the suggest event, search page event, Recommendations widget view/click events, product page view, add to cart, and conversion page view events.

  • See src/config.js file to configure it to run for your account and catalog.
  • See src/hooks/useAnalytics.js file to see how the pixel events are formatted.
  • Search for the term trackEvent to see how the pixel events are instrumented across the source code.

Note: On CodeSandbox, because of how the preview is rendered in the iframe, the pixel script is not able to set the _br_uid_2 cookie on the right domain, so you will not see the cookie sent in the pixel events. For the cookie to be set and sent in the pixel events, open the CodeSandbox preview in a new tab or run the example locally.

Demo preview

Demo preview

How to Use

  • Download the example or clone the repository to your local machine.
  • Install the dependencies and run the development server.
npm ci
npm run dev

OR

Edit right away in Sandbox.

CodeSandbox Favicon Example