Last active
May 5, 2017 11:47
-
-
Save andrei-tofan/0a138cacf34ffe6b3cdffc36b2593552 to your computer and use it in GitHub Desktop.
LeadBI user identification api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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