Last updated 02/08/2024
Before adding user events, make sure you have added the initialization script tag.
User events are used to define your website’s user journey, as milestones are reached for each user on your website. You can create a user event for when a user does an action you are interested in monitoring, such as unlocking pricing, starting a free trial or downloading a coupon, discount code, or a (content gated) white paper or eBook. In this way, you can see where users are in their progression through your website’s journey as a customer.
To add user events to any page you just need to follow these few steps:
First, create your user event under User Events in Bread & Butter. For steps on how to do this, check out our User Events page.
Make sure you take note of the event code when you create it, so you can use it below.
Identify the button or link that you want to trigger the user event. Add an ID attribute to the corresponding HTML element and make a note of it, e.g.
<button id="learn-more">Learn More</button>
Find the initialization script you have added to your webpage (see initialization script if you have not added it already)
In the initialization script, find the line:
BreadButter.configure({app_id: "[APP_ID]"});
Add the following line under BreadButter.configure();
BreadButter.ui.addEventToLink('LINK_ID', 'CUSTOM_EVENT');
You can also add a user event call to any scenario programmatically by adding this line:
BreadButter.events.custom("CUSTOM_EVENT", callback);
More details on this are available on our GitHub.
Don’t use Bread & Butter? Want to learn more about how Bread & Butter solves the four biggest problems facing marketers today? Book a demo and see how Bread & Butter is helping marketers make the most of their first-party data
Add authentication & API event tracking to your website/app with a script tag & configuration