Setting up beans.js on your online store
The Beans.js is a lightweight library that allows you to integrate Beans Ultimate on any e-commerce store. It provides the ability to add all the beans apps to your online store with a few lines of code. It also allows great flexibility if you want to customize the storefront display.



The latest version of the Beans.js is available here
<script src="<<public_id>>"></script>
Include the Beans.js script on each page of your site — it should always be loaded directly from, rather than included in a bundle or self-hosted. To help Beans.js authenticate the customer, and track user actions such as referrals, make sure to integrate the script on every page of your website and not just on the cart or checkout page.
The public_id is a unique identification key that represents your shop.


Beans.js accepts parameters to make it easier for you to set up each app exactly the way you need it.
currentPage: "home",
onAbout: () => {windows.location.href = "pages/rewards"},
onLogin: () => {windows.location.href = "pages/login"},
onRegister: () => {windows.location.href = "pages/register"},


To help authenticate existing customers you need to add a snippet to let Beans.js identify them. Beans will identify the customer using a combination of their id and their email to prevent impersonification. The authentication script should be set before the call of the init .
<script>window.beans_cjs_id = '1234567890'; window.beans_cjs_email = '[email protected]';</script>
Copy link
On this page