Skip to content

Instantly share code, notes, and snippets.

@kmclaugh
Last active May 27, 2021 17:06
Show Gist options
  • Save kmclaugh/f911598129279c847f228e76070c29ed to your computer and use it in GitHub Desktop.
Save kmclaugh/f911598129279c847f228e76070c29ed to your computer and use it in GitHub Desktop.
fixmycar.io

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

  1. Signs up
  2. Logs in
  3. Requests a quote
  4. Request a service

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

/*
* action: login
* description: fire whenever a returning user logs in
* url: https://www.fixmycar.io/login
* 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: request a quote
* description: fire whenever a user requests a quote
* url: https://www.fixmycar.io/appointment/end
* notes:
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "quoteRequest",
data: {
quoteInfo: {
services: [
{serviceName: "{{serviceName}}"},
...
],
car: {
make: "{{make}}",
model: "{{model}}",
year: "{{year}}"
},
userInfo: {
userId: "{{userId}}", // The user id
emailAddress: "{{emailAddress}}", // The user's email address
}
},
});
/*
* action: service request
* description: fire whenever a user requests a service
* url: ?
* notes: not sure where this happens
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "serviceRequest",
data: {
serviceInfo: {
totalPrice: "{{servicePrice}}",
services: [
{serviceName: "{{serviceName}}"},
...
],
car: {
make: "{{make}}",
model: "{{model}}",
year: "{{year}}"
},
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
* url: ?
* notes: not sure where this happens. Is it after they create a quote?
*/
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