Bubble
Paste one script into your Bubble app's header to record pageviews, then send events from any workflow.
Add the script
Open the header field
In the Bubble editor, go to Settings → SEO / metatags and find Script/meta tags in header.
Paste the script
<script
src="https://cdn.databuddy.cc/databuddy.js"
data-client-id="YOUR_CLIENT_ID"
crossorigin="anonymous"
async
></script>Your Client ID is in the Databuddy dashboard under your website's Settings → General.
Deploy to live
Deploy your app, open the live version, and click through a few pages. They appear on your dashboard.
Send an event from a workflow
Add a Run JavaScript action to any workflow. It comes from a plugin such as Toolbox.
window.databuddy?.track("plan_selected", {
plan: "pro",
page_path: window.location.pathname,
});Insert Bubble's dynamic data into the values with the expression editor. Test with fixed values first, then swap in dynamic ones.
Count screens that don't change the URL
Databuddy counts a pageview whenever the URL changes. Showing and hiding groups on one page doesn't change it, so send an event when a group becomes visible:
window.databuddy?.track("screen_viewed", { screen: "dashboard" });To test an event, trigger its workflow and look for a request to basket.databuddy.cc in the browser's Network tab.
Turn on more tracking
Add attributes to the script tag:
<script
src="https://cdn.databuddy.cc/databuddy.js"
data-client-id="YOUR_CLIENT_ID"
data-track-outgoing-links
data-track-web-vitals
data-track-errors
crossorigin="anonymous"
async
></script>Related
How is this guide?