To add Splitbee to your website, add the following script tag to the <head> of your website.
<script async src="https://cdn.splitbee.io/sb.js"></script>
Make sure to include the async or defer attribute. It allows your page to load without waiting for the 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.
All page views are automatically tracked. We support this for both traditional web sites like WordPress and basic HTML pages and SPAs like React, Angular, and Vue.
Conversion events can be tracked with minimal code. For more information check out event tracking.
You can enable the new cookie-less mode by adding the
data-no-cookie attribute to the Splitbee script tag.
<script data-no-cookie async src="https://cdn.splitbee.io/sb.js"></script>
While using the no cookie mode, users will not get tracked across multiple days.
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.
<script data-token="YOUR_TOKEN" async src="https://cdn.splitbee.io/sb.js"></script>
data-respect-dnt attribute to the script tag in order to respect the do not track setting of the browser.
<script data-respect-dnt async src="https://cdn.splitbee.io/sb.js"></script>
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:
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.
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.