User properties are stored values that are bound to a specific user. This could be their email address, their current plan or any other data you might want to store. You can view this data inside the user explorer, or use it in inside automations to personalise messages.
A user with custom data attached is called a Profile. Each user with custom properties that was active this month counts against your monthly usage limit.
splitbee.user.set({plan: 'Free'})
If you have authenticated users using your app or website, you can make sure they get recognised through multiple sessions and devices by setting a userId. This ID can be anything, but make sure it is unique and stays the same for each user. You can set the userId property using splitbee.user.set({userId:'yourUniqueId'})
.
If you don't set a userId, Splitbee will try to use the id or email property as unique identifier instead. Users with the same id (userId, id, email) get merged together automatically.
Use the splitbee.user.set()
function to store data to the current user. When this function is called, it will convert an anonymous session into a Profile.
splitbee.user.set({plan: 'Enterprise', appVersion: '1.0.0'})splitbee.user.set({displayName: 'Anna'})
This function can be called at any time. Data is appended by default. If the same field is received, it will be overwritten.
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'} |
If you added Splitbee via a script tag, it may be undefined
if you invoke it directly on load. To solve this, you can put your tracking code inside the "onload" function of the script tag.
<script async src="https://cdn.splitbee.io/sb.js" onload="if(window.splitbee) splitbee.user.set({ email: '[email protected]'})"></script>