Add Splitbee To Your Websitee

Web Analytics

To add Splitbee to your website, add the following script tag to the <head> of your website.

Make sure to include the async or defer attribute. It allows your page to load without waiting for the script.

<script async src=""></script>
Splitbee will only show data coming from your project domain directly. Splitbee will not accept data from development environments.

If you are using a package manager like NPM or Yarn for your project, you can use @splitbee/web. It offers an improved way to work with Splitbee.js inside your app.

Automatic Tracking

All page views are tracked by default. This applies to traditional web-sites like WordPress or basic HTML pages as well as for single-page applications with client-side routing. Splitbee will detect and track route changes automatically.

Conversion events can be tracked with minimal code. For more information check out event tracking.


To send traffic from another subdomain to the project, you need to add the data-token attribute to the script tag. The token can be found in your project settings.

Next steps

After adding the script you will start to see data flow into your dashboard. To get the most out of Splitbee we recommend looking into event tracking and storing user properties. They allow you to do things like:

  • Track conversion events
  • Capture form data and attach it to a user
  • Assign data to a user, like their email address

Enable A/B Testing

When using A/B testing you need to use the sb-ab.js script, as the default script does not include split testing. You can prevent the initial content flash by making the script blocking.
This can be achieved by removing the async property.

<script src=""></script>

This will make sure the page will render after the test has been executed, thus preventing your users from seeing the wrong variant of a split test.