Skip to content

Instantly share code, notes, and snippets.

@kmclaugh
Last active June 9, 2021 15:14
Show Gist options
  • Save kmclaugh/9c9a4126a22940dd276c8a87e9697cb5 to your computer and use it in GitHub Desktop.
Save kmclaugh/9c9a4126a22940dd276c8a87e9697cb5 to your computer and use it in GitHub Desktop.
Datalayer Signup and Login

Below is the code that needs to be added when the user

Signs up Logs in

The {{variable}} templates need to be filled in with the actual values.

/*
* action: login
* description: fire whenever a returning user logs in
* notes:
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "login",
data: {
userInfo: {
userId: "{{userId}}", // The user id
emailAddress: "{{emailAddress}}", // The user's email address
}
},
});
/*
* action: signup
* description: fire whenever a new user signs up for the first time
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "signup",
data: {
userInfo: {
userId: "{{userId}}", // The user id
emailAddress: "{{emailAddress}}", // The user's email address
}
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment