Every user has stored properties. It is possible to set custom user data that can be viewed inside the dashboard for each individual user.
Name | Description |
---|---|
id | Random generated ID from Splitbee |
country | Country of the user |
lastSeen | Timestamp the user was last active |
browser | Browser of user |
os | Operating System |
deviceType | desktop, smartphone |
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
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: "hello@splitbee.io"})
This function can be called at any time. It will overwrite all fields that are sent and already present in the user's properties.
Event Data | Stored 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'} |
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="https://cdn.splitbee.io/sb.js" onload="if(window.splitbee) splitbee.user.set({ email: 'some@data.com'})"></script>