Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@andrei-tofan
Last active May 5, 2017 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • 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: 'john.doe@test.com', // 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