Documentation menuWebsite builders: Bubble

Website builders

Add Loogika to Bubble

You add Loogika to a Bubble app by pasting the script tag into the header field of the SEO / metatags settings. Bubble prints that field in the head of every page of the app. The tag reaches your visitors when you deploy the app to Live.

Last updated .

What do you need before you start?

You need the script tag for your site. Open Site Settings in the Loogika dashboard and copy the tag from the Tracking Script tab. The tag already holds your site ID, a 12-character string, where this example says YOUR_SITE_ID:

<script src="https://app.loogika.com/api/script.js?siteId=YOUR_SITE_ID" defer></script>

How do you add the Loogika tag to a Bubble app?

The tag goes into one app-wide setting, so you do not edit single pages.

  1. With your app open in the Bubble editor, go to the left sidebar and click the Settings tab.
  2. Choose the SEO / metatags sub-tab.
  3. Find the Script/meta tags in header field further down and paste the tag into it.
  4. Deploy the app to Live.

Bubble stores the header code as part of an app version. The development version and the live version are separate, so a saved setting does nothing for visitors until you deploy.

How do you check that Loogika is installed?

Open the live app in another tab and visit a few pages. The pageviews show up in the Loogika dashboard within a few seconds.

If the dashboard stays empty, view the page source of the live app and search for script.js?siteId=. A missing tag on a Bubble app usually means the setting was saved but never deployed to Live. The script troubleshooting page covers ad blockers and the other common causes.

How do you track events from a Bubble workflow?

Bubble workflows can run JavaScript through the Run JavaScript action, which comes with the free Toolbox plugin. Put a call to window.loogika.event() in that action to send an event from any workflow trigger.

  1. In the Workflow tab, choose the trigger. When Button Signup is clicked is one example.
  2. Add a Run JavaScript action to the workflow.
  3. Paste the call below and insert Bubble's dynamic expressions for the values you want to send.
if (window.loogika) {
  window.loogika.event("signup_clicked", {
    plan: "Current User's Plan",
  });
}

The if check keeps the workflow from failing when a visitor's ad blocker has stopped the script. The page about custom events lists the limits for event names and properties.

Why does Loogika record only the first pageview in a Bubble app?

Loogika records a new pageview when the URL changes. Many Bubble apps keep everything on one page and switch between groups, and the URL stays the same when a group is shown. The script then sees no change.

For such an app, call window.loogika.pageview() from a Run JavaScript action at the moment the group becomes visible. You can also send a custom event for each view. Apps that move between real Bubble pages need neither, because Loogika tracks those page loads automatically.