Bento
  • Go to Marketing Site
  • Go to App
  • User Work Laptop Streamline Icon: https://streamlinehq.comAccount

  • Graduation Cap Streamline Icon: https://streamlinehq.comGet Started

  • Migration Guides

  • DNS Setup

  • Connection Integration System Api Streamline Icon: https://streamlinehq.comAPI for Developers

  • Package Streamline Icon: https://streamlinehq.comSDK Guides

    • SDKs
    • .Net
    • Elixir
    • Golang
    • Javascript
    • Laravel
    • Next.js
    • Node.js
    • PHP
    • Python
    • Ruby on Rails
    • Rust
    • Statamic
  • Plugs Streamline Icon: https://streamlinehq.comIntegrations

  • Horizontal Menu Streamline Icon: https://streamlinehq.comMisc

  • Sign in

Bento JavaScript SDK Guide

This guide covers integrating Bento's JavaScript SDK for client-side analytics, user tracking, and engagement features.

Client-Side Only: This SDK is designed for browser environments. For server-side tracking, use our Node.js SDK.

Getting Started
# Installation
# Basic Setup
Core Features
# Page View Tracking
# User Identification
# Event Tracking
Advanced Features
# User Tagging
# Custom Fields
# Survey Integration
Reference
# API Reference
# Best Practices

Additional Resources

# Troubleshooting
# FAQ
Learning Computer Streamline Icon: https://streamlinehq.com
Getting Started
1
Installation

Installation

Add the Bento tracking script to your website:

You can find your Site UUID in your Bento Account Settings.

Replace YOUR_SITE_UUID with your actual Site UUID from Bento.

2
Basic Setup

Basic Setup

Once the script loads, Bento is automatically available via the global window.bento object:

The SDK automatically:

  • Generates unique visitor and visit IDs
  • Tracks the initial page view
  • Handles visitor session management
3
Verification

Verify the integration is working:

Check your browser's developer console for Bento confirmation messages.

Learning Computer Streamline Icon: https://streamlinehq.com
Core Features

Page View Tracking

Page views are automatically tracked when the script loads. For single-page applications, track navigation manually:

Manual Page View Tracking

SPA Navigation Tracking

User Identification

Connect user actions across sessions by identifying users with their email:

Basic Identification

Dynamic Identification

Event Tracking

Track custom events to understand user behavior and trigger workflows:

Basic Event Tracking

Events with Data

Common Event Examples

Learning Computer Streamline Icon: https://streamlinehq.com
Advanced Features

User Tagging

Add tags to segment users and trigger targeted campaigns:

Single Tag

Multiple Tags

Custom Fields

Store additional user data for personalization and segmentation:

Basic Fields

Progressive Profiling

Survey Integration

Bento includes built-in survey functionality for collecting user feedback:

Survey Forms

Add survey forms to your HTML:

Available Survey Types

TypeDescriptionUse Case
popupModal overlay surveyExit intent, feedback
toasterSmall notification surveyQuick polls, ratings
takeoverFull-screen surveyDetailed questionnaires
inlineEmbedded in page contentContent-specific forms
Learning Computer Streamline Icon: https://streamlinehq.com
API Reference

Core Methods

MethodDescriptionExample
bento.view()Track page viewbento.view()
bento.identify(email)Identify user by emailbento.identify('[email protected]')
bento.track(event, data)Track custom eventbento.track('signup', { plan: 'pro' })
bento.tag(tag)Add tag to userbento.tag('premium_user')
bento.updateFields(fields)Update user fieldsbento.updateFields({ name: 'John' })

Utility Methods

MethodDescriptionExample
bento.getEmail()Get current user emailconst email = bento.getEmail()
bento.getName()Get current user nameconst name = bento.getName()

Survey Methods

MethodDescriptionExample
bento.showSurveyForm(element, id, type)Show survey formbento.showSurveyForm(el, 'survey-1', 'popup')
bento.spamCheck(email)Validate emailbento.spamCheck('[email protected]')

Chat Methods (if enabled)

MethodDescriptionExample
bento.showChat()Enable chatbento.showChat()
bento.hideChat()Hide chatbento.hideChat()
bento.openChat()Open chatbento.openChat()
Learning Computer Streamline Icon: https://streamlinehq.com
Best Practices

Performance

Load Optimization

Event Debouncing

Prevent excessive event tracking:

Data Quality

Email Validation

Error Handling

Privacy

Conditional Tracking

Learning Computer Streamline Icon: https://streamlinehq.com
Troubleshooting

Common Issues

IssueSolution
Script not loadingVerify Site UUID is correct and script URL is accessible
Events not trackingCheck browser console for errors, ensure window.bento exists
Double trackingRemove duplicate script tags, check for multiple installations
CORS errorsEnsure your domain is whitelisted in Bento settings

Debug Mode

Enable debug logging:

Network Issues

Learning Computer Streamline Icon: https://streamlinehq.com
FAQ

PreviousGolang
NextLaravel

© Copyright 2025. All rights reserved.

Follow us on XFollow us on GitHubJoin our Discord server

What's on this page

  • Installation
  • Basic Setup
  • Page View Tracking
  • User Identification
  • Event Tracking
  • User Tagging
  • Custom Fields
  • Survey Integration
  • Performance
  • Data Quality
  • Privacy