Website builders · 3 min setup

How to add analytics to a Bubble app

To add VisitTrack to Bubble, paste the script tag into Settings → SEO / metatags → Script/meta tags in header, then deploy to Live. Add data-exclude="/version-test*" so your development version doesn't count as real traffic.

Updated

Bubble applies header scripts on paid plans. Bubble serves your development version under /version-test on the same domain as Live, which is easy to forget: without the exclusion, every test run of a workflow shows up in your analytics.

Bubble at a glance

Where the tag goes
Settings → SEO / metatags → Script/meta tags in header
Plan needed
A paid Bubble plan for custom header scripts
Dev version
Exclude with data-exclude="/version-test*"
Events
Workflow → Run javascript (Toolbox plugin)
Goes live
After Deploy to Live

How to install VisitTrack on Bubble

  1. Step 1: Copy your site id

    Add your app's domain as a site in VisitTrack and copy the snippet from the install step. Replace SITE_ID below.

  2. Step 2: Open Settings → SEO / metatags

    In the Bubble editor, open Settings → SEO / metatags and scroll to Script/meta tags in header.

  3. Step 3: Paste the tag with the version-test exclusion

    data-exclude takes comma-separated paths with * as a wildcard, and is checked on every event — so nothing from the development version is sent.

    Script/meta tags in header
    <script defer data-site="SITE_ID" data-exclude="/version-test*" src="https://visitrack.app/tracker.js"></script>
  4. Step 4: Deploy to Live

    Deploy the app to Live, then open the live URL (not /version-test) and use it for a minute.

How to check VisitTrack is working on Bubble

  1. Open the Live app and visit two pages.
  2. VisitTrack's live view shows you within seconds; the Pages tab lists both pages.
  3. Open /version-test too and confirm it doesn't appear — with data-debug on the tag, the console logs ignored for those events.

Each Bubble page (/index, /dashboard, /settings) is counted by its path. Bubble apps often switch "tabs" on one page by changing URL parameters (/dashboard?tab=billing) — the path stays the same, so those aren't separate pageviews.

If those in-page screens matter, fire a custom event when you show them (below) — screen_view with a screen prop works well — and build a funnel from it.

How to track custom events and goals in Bubble

Install the free Toolbox plugin to get a Run javascript action, then add it to a workflow right after the step that matters — for example after Sign the user up. Bubble lets you insert dynamic data into the code with the expression editor, such as the current user's unique id.

To tie visits to accounts, call identify in the same workflow; the person then appears in VisitTrack's People tab with their traits.

Toolbox → Run javascript
// Workflow: Sign the user up → Run javascript
window.visitrack && window.visitrack("signup", { plan: "free" });

// Optional, same workflow: link this visitor to the Bubble user
window.visitrack && window.visitrack.identify("Current User's unique id", { plan: "free" });

For a click-only event, an HTML element containing <a href="/pricing" data-vt-goal="pricing_click"> works too. Then make the event a goal in Settings → Goals. Replace the quoted user id above with Bubble's dynamic expression.

Revenue attribution on Bubble

Revenue attribution needs the visitor id on the payment. If you charge with Stripe Payment Links, the Stripe guide's Payment Link snippet adds it automatically — paste it into the header field after the tracker. If you create Stripe Checkout Sessions through the API Connector, pass the visitor id (read with window.visitrack.visitorId() in a Toolbox "JavaScript to Bubble" element) as client_reference_id.

Script options you might need on Bubble

All optional — add them to the same tag. Full reference: script configuration.

AttributeWhat it does
data-cookielessStore nothing in the browser; the server derives a daily-rotating id. See cookieless mode.
data-exclude="/app/*"Never track these paths (comma-separated, * wildcard). Checked on every navigation.
data-allow-localTrack on localhost and *.local — for testing an install only.
data-debugLog every event the script sends, and why it skipped one, to the console.
data-auto="false"Turn off automatic events (downloads, contact clicks, form submits, rage clicks, JS errors, 404s).

Bubble troubleshooting

Development traffic in your stats

Add data-exclude="/version-test*" to the tag and redeploy, or save only your live domain under Allowed hostnames.

The header field has no effect

Custom header scripts need a paid plan, and changes reach Live only after you deploy.

Run javascript does nothing

The action must run in the browser (a page workflow, not a backend workflow). Backend workflows can call POST /api/track through the API Connector instead — see server-side events.

Events have the literal text of the expression

Insert the value with Bubble's dynamic expression editor inside the quotes, and check the Toolbox action's code preview.

Bubble analytics FAQ

Where do I add a script tag in Bubble?

Settings → SEO / metatags → Script/meta tags in header. It's output in the head of every page of your app on a paid plan after you deploy to Live.

How do I stop Bubble's version-test from being tracked?

Add data-exclude="/version-test*" to the script tag. The tracker checks excluded paths on every event and sends nothing for them.

Can I track Bubble workflows as conversions?

Yes. Add a Toolbox Run javascript action to the workflow and call window.visitrack("event_name"). Then turn the event into a goal or a funnel step in VisitTrack.

Can VisitTrack identify Bubble users?

Yes. Call window.visitrack.identify with the user's unique id and traits from a Run javascript action after login or signup. See People & identify.

Do I need a cookie banner with VisitTrack on Bubble?

Not in cookieless mode, which stores nothing in the browser. General information, not legal advice.

Keep going

Add VisitTrack to your Bubble site

Cookie-free analytics with revenue attribution, live visitors, funnels and session replays. One script tag, every feature on every plan. 14 days free, no card required.

Not on Bubble? See all 29 integration guides.