Put a callback, which will be called when the script is loaded and the user ID is received.
function onDashlyReady() {
console.log('Ok, done!')
};
dashly.onReady(onDashlyReady);
| Argument | Description |
|---|---|
callback |
Required. Function being called |
In case you’re sending User ID via dashly.auth, a situation is possible, when user’s ID is changed.
Example.
Registered user (with dashlyID=123, UserID=456) visits your site from another device. He’ll get a new dashlyID=789, UserID would be undefined. After the user has logged in, he’ll have dashlyID=123, UserID=456.
When dashlyID is changed (from 789 to 123) onReady method would be called again. If you’re collecting dashlyID on your side, you should rewrite identificator.