Bubble Integration Guide
This guide shows you how to add Heyo to your Bubble application without writing any code.
Installation
Step 1: Create an HTML Element
- In your Bubble editor, navigate to the page where you want to add the chat
- Click the Visual Elements tab
- Drag an HTML element onto your page
- You can place it anywhere - it won't be visible, but the chat will still work
Step 2: Add Heyo Code
Paste this code into the HTML element:
<script src="https://heyo.so/embed/script" defer data-project-id="YOUR_PROJECT_ID"></script>
Replace YOUR_PROJECT_ID with your actual Project ID from the Heyo dashboard.
Step 3: Make it Site-Wide (Optional)
To show the chat on all pages:
- Create a Reusable Element (Element → New Reusable Element)
- Name it something like "Heyo Chat Widget"
- Add the HTML element with the Heyo code to this reusable element
- Add the reusable element to each page's header or footer
Show Chat Only to Logged-In Users
Using Conditional Formatting
- Select your HTML element containing the Heyo code
- Click the Conditional tab
- Add a condition: "When Current User is logged out"
- Set "This element is visible" to unchecked
This will hide the chat widget when users are not logged in.
Pass User Data to Chat
Method 1: Using Bubble Workflows
Create an HTML element with dynamic content:
<script src="https://heyo.so/embed/script" defer data-project-id="YOUR_PROJECT_ID"></script>
<script>
window.addEventListener('load', function() {
if (window.HEYO && <Current User is logged in>) {
window.HEYO.init({
projectId: 'YOUR_PROJECT_ID',
user: {
name: '<Current User's name>',
email: '<Current User's email>',
id: '<Current User's unique id>'
}
});
}
});
</script>
To insert dynamic data:
- Click "Insert dynamic data" in the HTML code editor
- Select the appropriate Bubble field (e.g., Current User's name)
- Repeat for email and ID
Method 2: Using Custom States
If you store user data in custom states:
- Set up custom states for user info
- Reference them in your HTML element using dynamic data
- Use "Insert dynamic data" to populate the user object
Advanced Usage
Show Chat on Specific Pages
Create page-specific HTML elements instead of using a reusable element. Add the Heyo code only to pages where you want chat to appear.
Different Widgets for Different User Types
- Create multiple Heyo projects in your dashboard (e.g., one for free users, one for premium)
- Use conditional formatting to show different HTML elements based on user type
- Each HTML element uses a different
data-project-id
Example setup:
- Element 1: Shows for free users with Project ID A
- Element 2: Shows for premium users with Project ID B
Custom Chat Button
Hide the default Heyo button and create your own:
HTML Element for Heyo (hidden):
<script src="https://heyo.so/embed/script" defer data-project-id="YOUR_PROJECT_ID"></script>
<style>
#heyo-widget-button {
display: none !important;
}
</style>
Custom Button in Bubble:
- Create a Button element with your custom design
- Add a Workflow: "When Button is clicked"
- Add action: "Run JavaScript" (requires plugin)
- JavaScript code:
window.HEYO?.show();
Note: This requires the "Toolbox" plugin or similar JavaScript runner plugin.
Track Page Views
Send context about what users are viewing:
<script>
window.addEventListener('load', function() {
if (window.HEYO) {
window.HEYO.trackEvent('viewing_page', {
page: '<Current Page name>',
url: window.location.href
});
}
});
</script>
Responsive Design
Heyo is automatically responsive. However, if you want to adjust positioning for mobile:
Add this CSS in an HTML element:
<style>
@media (max-width: 768px) {
#heyo-widget-button {
bottom: 80px !important; /* Adjust as needed */
}
}
</style>
Best Practices
- Use a reusable element for site-wide chat
- Set conditional visibility based on user login status
- Pass user data for personalized support
- Test on both desktop and mobile responsive modes
- Keep the HTML element hidden (it doesn't need to be visible)
Troubleshooting
Chat widget not appearing
- Verify your Project ID is correct
- Check that the HTML element is not hidden by conditions
- Ensure the element is on the page (check element tree)
- Preview/deploy your app to see changes
Widget appearing multiple times
- Make sure you haven't added multiple HTML elements with the same code
- Check that reusable elements aren't duplicated
Dynamic data not working
- Ensure you're using "Insert dynamic data" not just typing field names
- Check that Current User fields are accessible
- Verify user is logged in when passing user data
Not working in preview mode
- Some features may only work after deployment
- Try using Bubble's "Live" version instead of "Development"
Bubble Plugins Compatibility
Heyo works alongside other Bubble plugins without conflicts. It's compatible with:
- Toolbox (for advanced JavaScript control)
- All authentication plugins
- Payment processors (Stripe, etc.)
- Analytics plugins