Which setup you need
Choose a function
UsefireSlimPurchaseEvent. It sends only the order ID, which is all Northbeam needs.
Northbeam uses the order ID to match the purchase to your backend order. Revenue, tax, shipping, and line items always come from your backend order data (through Shopify or the Orders API), never from the browser.
Fire the function on the Order Confirmation or Thank You page, after the order is complete. You can add it to your site’s code or through Google Tag Manager.
Requirements
Whichever function you use, it must:- Fire after the Northbeam Pixel has loaded.
- Fire only after the order is final and payment has been processed. This keeps cancelled transactions out.
- Fire once per order. See Fire once per order.
- Use the exact order ID your backend sends to Northbeam. See Match the order ID exactly.
Match the order ID exactly
Northbeam uses theid value to match the purchase event to your backend order (the order_id you send through the Orders API).
The two values must match exactly, including capitalization. If they don’t, the purchase won’t attribute.
Fire once per order
Your purchase event must fire exactly once for each order. If it fires more than once for the same order, Northbeam may not match the purchase to your backend order, and the order can show as unattributed. Common causes of duplicate fires:- The customer refreshes or revisits the Order Confirmation page (for example, from a bookmark or a link in the confirmation email).
- The script is installed twice (for example, hard-coded on the site and added in Google Tag Manager).
- A Google Tag Manager trigger fires on more than one event (for example, both Page View and DOM Ready).
- A single-page checkout re-renders the confirmation step.
fireSlimPurchaseEvent
Sends only the order ID. This is the recommended function for every store.
"A123" with the variable that holds your order ID. Pass the value directly. You don’t need to wrap it in an object.
You don’t need to send revenue or other order details. Northbeam gets those from your backend order data.
firePurchaseEvent
The original purchase function. It sends the order ID plus order details like revenue, tax, shipping, and line items.
Northbeam only uses the order ID from this event. The other fields aren’t used for reporting, because order details come from your backend. If you’re setting up purchase tracking now, use fireSlimPurchaseEvent instead. If you already use firePurchaseEvent and it works, you don’t need to change it.
id is the only required field. It must exactly match the order_id in the Orders API. For other fields, an empty string ("") or 0 is fine when a value doesn’t apply. Avoid null.
Field reference
Field reference
Order fields
Line item fieldsThese fields go inside each object in
lineItems. They can’t be used outside it.Validation and testing
Open your browser’s Network tab before you complete a test order. The requests can’t be reviewed after the fact. When the event fires correctly, you’ll see two nb-collector requests together:- One with a payload containing
data: [{e: "ue",…}] - One with a payload containing
data: [{e: "se",…}]. Its se_la value is the order number Northbeam received.
Google Tag Manager
If you add the purchase event through Google Tag Manager:- Sequence your tags. The Northbeam Pixel tag must fire before the purchase event tag. See Google’s guide to tag sequencing.
- Use one trigger. Make sure the tag fires on a single event, so it doesn’t fire twice.
- Publish the container. Unpublished changes don’t track anything.
Final checklist
Before going live, confirm:- The purchase event fires on the confirmation page
- It fires exactly once per order, and refreshing the confirmation page does not fire it again
- The order ID matches your backend order data exactly
- The Northbeam Pixel fires first
- Your Google Tag Manager container is published (if you use it)
Best practices
- Log success and failure. Wrap the purchase function in code that logs whether it ran. This makes testing much easier.
- Wait for the pixel. Check that
window.Northbeamis ready before calling the function, and retry if it isn’t. This prevents load-order problems.
Example with logging and retry
Related
- Custom: full setup for custom stores
- Identify Events: when your checkout can’t pass the order ID
- Purchases or Orders Are Missing: troubleshooting unattributed orders