Skip to main content

Why it is required

The pixel establishes _bonsai_s, the first-party identifier that ties a shopper’s page views, searches, Concierge conversations and orders together. Only the pixel creates one. The search and Concierge components read it and never mint their own, because an identifier created anywhere else would join to nothing. Without the pixel, <bonsai-search> still works — but every event it emits reports NOT_SET, and none of your search analytics can be attributed to a session, a campaign or an order. The SDK says so in the browser console:
If you see that line, the pixel is missing from that page.

Install

Add this to every page of the storefront, ideally in <head> so it runs before the search components load. Google Tag Manager is the usual delivery path in production — one Custom HTML tag installs the queue, and one tag per funnel event calls bonsaiq("track", …).

init options

All four are required — every install states all four, so the call site fully describes the behaviour it gets.
cookieDomain must be the registrable domain with a leading dot if the identifier should survive across subdomains — www.example.com and shop.example.com otherwise get separate shoppers.

Funnel events

track accepts five event names: Each takes an optional payload: { contents, amount, currency, cart_token, checkout_token, event_id }.
amount is in integer minor units1999, not 19.99. A non-integer amount is dropped along with currency.

Verify

  1. Load a page with the pixel installed.
  2. Confirm the console shows no _bonsai_s warning.
  3. Run a search and confirm the request carries a shopper identifier rather than NOT_SET.