Limio now allows you to pull user details for use in other components or scripts, such as a live chat widget injected via a script. The user details available are; given name, family name and email and have a default value of undefined.
Utilising the pattern described in this article under the "Capturing Events within the Data Layer" it is possible to use a callback function like the one below:
<script>
limio.dataLayer.subscribe(cb)
//where the callback function had the following signature
let userDetails = {}
function cb(event) {
if (typeof dataLayer === 'object' && event.event === "user-authentication") {
userDetails.firstName = event.user.given_name
userDetails.lastName = event.user.family_name
userDetails.email = event.user.email
}
}
</script>
In the above example the callback function will update the userDetails object every time a user-authentication event is fired. A user-authentication event happens on login and logout.
Comments
0 comments
Please sign in to leave a comment.