Skip to content

Instantly share code, notes, and snippets.

@andrei-tofan
Last active May 5, 2017 11:47
Show Gist options
  • Save andrei-tofan/0a138cacf34ffe6b3cdffc36b2593552 to your computer and use it in GitHub Desktop.
Save andrei-tofan/0a138cacf34ffe6b3cdffc36b2593552 to your computer and use it in GitHub Desktop.
LeadBI user identification api
// check if $leadbi_website api is available
if(window.$leadbi_website){
// fetch user object of the current visitor
window.$leadbi_website.getCurrentUser(function (err, user) {
// call the identify api
// calling this method multiple times for the same email address will not create duplicate contacts
return user.identify({
first_name: 'John', // optional,
last_name: 'Doe', // optional
email: '[email protected]', // required
company: 'Test Inc', // optional
role: 'CEO', // optional
attributes: { // other attributes to be associated with the user
example_attribute: 'test'
}
}, function (err) {
if(err){
// something went wrong
}else{
// the user has been identified
}
})
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment