Bento Tracking Script Integration

Overview
The tracking script sends browser activity into Bento so you can build segments and workflows from website behavior. It covers four common jobs:
- Track page views as
$pageevents. - Identify logged-in visitors by email.
- Update subscriber fields from browser context.
- Track custom events such as
demo_booked,pricing_viewed, orpurchase.
Requirements
- An approved Bento account
- Ability to edit your website's source code so you can add the tracking script
Tracking Script Installation
site_uuid placeholder, replace it with your site UUID from the Bento Teams screen.How the connection works
When a visitor browses your site, bento.js loads in the browser and sends events to Bento. Anonymous browsing starts as an anonymous visitor. Once you call bento.identify("person@example.com"), Bento can connect future browser events to that subscriber.
Identify logged-in users
Call identify as soon as your app knows the visitor's email. Do this before bento.view() or bento.track() when possible.
Update fields
Use updateFields for profile data you want to use in segments, workflows, or Liquid.
Keep field names stable. A small set of predictable fields is easier to use than many one-off keys.
Track custom events
Custom events are best for product and marketing behavior that should trigger automation.
Good event names describe what happened. Use names such as demo_booked, trial_started, checkout_started, or feature_used.
Track purchases
For purchase tracking, include a unique key so refreshes and duplicate page loads do not inflate value.
Debugging
| Problem | What to check |
|---|---|
| No page views | Confirm the script URL uses the correct site UUID and is present on the published page. |
| Events stay anonymous | Call bento.identify() before tracking the event when the email is known. |
| Fields do not appear | Send fields before the event, then inspect the subscriber in Bento. |
| Duplicate purchase value | Add unique.key to purchase events. |
| Custom event does not trigger a workflow | Match the workflow trigger to the exact event name. |
