JavaScript Tracking + Bento
Install the Bento browser snippet on any site to stream page views, identities, and custom events into your automations.
+
tracking analytics client
Install the Bento browser snippet on any site to stream page views, identities, and custom events into your automations.
Quick facts
- Vendor
- Bento
- Category
- second party
- Tags
- tracking, analytics, client
Requirements
- Bento workspace with access to the tracking snippet
- Ability to edit the global `<head>` (or tag manager) for your site or app
- Publishing rights so you can deploy the updated template
Overview
The JavaScript snippet is the foundation for most Bento features. Once it loads, Bento:
- Records
$pageevents for every visit. - Identifies subscribers when you pass an email or user ID.
- Powers on-site chat, automations, and conversion reporting without extra SDKs.
Requirements
- Decide which Bento site (UUID) should own the traffic.
- Confirm you can add scripts to the
<head>of every page (framework layout, CMS theme, tag manager, etc.). - Plan a publish window so you can test in staging before pushing to production.
Installation
- In Bento, open System → Apps → Tracking (or System → Apps → JavaScript).
- Copy the snippet and replace
replace_this_with_your_real_site_uuidif it still shows a placeholder. - Paste it near the top of your global
<head>and publish the change.
<script src="https://app.bentonow.com/replace_this_with_your_real_site_uuid.js?js=true" async defer></script>
<script>
window.addEventListener("bento:ready", () => {
if (typeof bento$ !== "undefined") {
// Optional: identify the user before logging a view.
// bento.identify("customer@example.com");
// bento.updateFields({ plan: "pro" });
bento.view(); // log the initial page view
// Optional chat widget
// bento.showChat();
}
});
</script>
Verification checklist
- Load the site in an incognito window and open the browser console. You should see the script load without errors.
- In Bento, go to Events → $page and confirm new page views arrive with the correct URL and UTM data.
- Use
bento.identify("user@example.com")in the console to verify that subscriber activity ties to profiles.
How the connection works
The script loads asynchronously from Bento’s CDN. Once ready it exposes the bento helper (spelled bento$ in the legacy API) which:
- Queues events locally until the network call completes.
- Sends session data, device info, and metadata that power Bento segments and automation conditions.
- Hooks into chat, forms, and future integrations that depend on in-browser context.
Any additional custom events or fields you set via bento.track, bento.updateFields, or bento.identify immediately become available in Flows, reporting, and the shared inbox.***
Need the original Markdown? Open raw file