Bento JS SDK

How to navigate the Bento.js SDK

Note: https://github.com/bentonow/bento-js-sdk has the most up-to-date information regarding the Javascript SDK.

Installing Bento is really similar to how you have previously installed many of your other marketing tools in your stack. We have a small script, under ~30kb in size, that you add to the footer of your page. This little script powers all the amazing features in Bento.

Because you are adding Bento to the footer of the page, it also won't slow down your perceived load times at all. Visitors will see and be able to browse a snappy website like they've always done before.

This is fairly unique in the marketing world, as most scripts that perform similar features to us require you to put us in the header synchronously — but we've always believed that speed trade-off isn’t worth it.

We’ve seen instances where services have become overwhelmed for one reason or another and have slowed down all sites on their network.

Not the case with Bento.

A lot of web apps have a special spot for you to place the script, often this will be the same place where you would put your Analytics code like Google Analytics, Tag Manager or Clicky, but if you're unsure it's best to ask your site's developer or send us a message in chat.

Sidenote: If you have installed Bento on Shopify or WooCommerce then the asyncronous script has been installed for you.

When you first create a site in Bento, you will be shown a script that looks like this:

<script src="https://fast.bentonow.com?site_uuid={{ your_site_identifier }}" async defer></script>

Once added to your site the script will initialize Bento, track a single page view, and run Autofill.js (described later).

If you want full control over what events fire you can also install the syncronous version:

<script src="https://app.bentonow.com/{{ your_site_identifier }}.js"></script>

This version does not fire any additional actions and gives you full control of what you do. Below is a list of functions Bento.js gives you access to.

If you have their email address, identify the user. Do this before anything else as it adds data to an event: bento.identify('[email protected]');

This will automatically fill out form fields if the user is identified: bento.autofill();

You can log a custom event. This also sends all of the identity and field information to Bento to be processed: bento.track("$someAction", {some_key: "Some Value"});

You can subscribe them to marketing emails: bento.track("$subscribe", {}); bento.track("$unsubscribe", {});

You can tag a visitor: bento.tag('Some Tag');

You can add custom fields to your visitors which you can leverage for personalization: bento.updateFields({"first_name": "ash", "last_name": "ketchum"});

You can show Bento Chat by activating the below. bento.showChat();

At the very least, you should log a page view like this. bento.view();