User Properties

Every user has stored properties. It is possible to set custom user data that can be viewed inside the dashboard for each individual user.

Default properties

idRandom generated ID from Splitbee
countryCountry of the user
lastSeenTimestamp the user was last active
browserBrowser of user
osOperating System
deviceTypedesktop, smartphone

Add unique userId

If your users are authenticated and using your app on different devices you need to provide a property called userId in order to merge users & just keep the only user in Splitbee. You can set the userId property using splitbee.user.set({userId:'yourUniqueId'}) If you don't set a userId, Splitbee will use the id or email property as unique userId

Append custom data to a user

The Splitbee JS library is exposed globally on the window object. You can access it under window.splitbee or just splitbee for short.

Use the splitbee.user.set() function to store data to a user.

splitbee.user.set({plan:"Enterprise", appVersion: '1.0.0'})
splitbee.user.set({displayName: "Anna"})
splitbee.user.set({email: "[email protected]"})

This function can be called at any time. It will overwrite all fields that are sent and already present in the user's properties.

Example of sending multiple calls

Event DataStored Data of User
{plan:'Sandbox', appVersion: '1.0.0'}{plan:'Sandbox', appVersion: '1.0.0'}
{appVersion: '1.1.0'}{plan:'Sandbox', appVersion: '1.1.0'}
{name: 'Emily'}{plan:'Sandbox', appVersion: '1.1.0', name: 'Emily'}

Setting user data on page load

splitbee may be undefined if you invoke it directly after loading the script. To solve this, you can use the "onload" property of the script tag.

<script async src="" onload="if(window.splitbee) splitbee.user.set({ email: '[email protected]'})"></script>