Skip to content

Instantly share code, notes, and snippets.

@kmclaugh
Last active June 10, 2021 13:09
Show Gist options
  • Save kmclaugh/ff9feffe52cc5f0104137a9ae39a4ace to your computer and use it in GitHub Desktop.
Save kmclaugh/ff9feffe52cc5f0104137a9ae39a4ace to your computer and use it in GitHub Desktop.
Rebaid Data Layer
/*
* action: dashboard
* description: fire on every dashboard page
* url: https://rebaid.com/dashbaord
* notes:
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "dashboard",
eventName: "Dashboard",
data: {
userInfo: {
userId: "{{userId}}", // The user id
emailAddress: "{{emailAddress}}", // The email address
userType: "{{userType}}" // shopper or seller
}
},
});
/*
* action: product detail
* description: fire whenever a user views the details of a product
* required fields: product.id and product.name
* reference: https://www.simoahava.com/analytics/enhanced-ecommerce-guide-for-google-tag-manager/#product-detail-views
* notes: the products list should include ONLY the single product that the user is viewing
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "eec.detail",
eecEventName: "Product Detail View",
ecommerce: {
detail: {
actionField: {
list: "{{collection.title}}", // 'fall collection' // This should be empty if the page is just a single product detail page and not a list like search results or collections
},
products: [
{
id: "{{ product.id }}", // 'P12345' // use product id not variant id
name: "{{product.title}}", // 'awesome t-shirt'
brand: "{{shop.name}}", // the company name offering the rebate
price: '{{product.price}}', // 10.0 // the discounted price
variant: "{{product.selected_variant.variant.name}}", // 'large - yellow'
description:
"{{product.description | strip_newlines | strip_html | escape }}",
imageURL: "https:{{product.featured_image.src|img_url:'grande'}}",
productURL: "{{product.url}}",
},
],
},
},
});
/*
* action: seller create campaign
* description: fire whenever a seller creates a campaign
* url: https://rebaid.com/new_campaign/10052/step-3
* test-url: https://staging.rebaid.com/new_campaign/10052/step-3
* notes:
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "createCampaign",
eventName: "Create Campaign",
data: {
userInfo: {
userId: "{{userId}}", // The seller's user id
companyName: "{{companyName}}", // The seller's company name
emailAddress: "{{emailAddress}}", // The seller's email address
},
campaignInfo: {
campaignId: "{{campaignId}}",
campaignName: "{{campaignName}}",
campaignStore: "{{campaignStore}}", // Amazon, Walmart, etc
productTitle: "{{productTitle}]",
productDescription: "{{productDescription}}",
productCategory: "{{productCategory}}",
productUrl: "{{productUrl}}",
dailyCampaignCost: "{{dailyCampaignCost}}", // the daily cost for the campaign
campaignsCount: "{{campaignsCount}}" // whether it's the user's 1st, 2nd, 3rd, etc campaign. include status: active, pause, ended
},
rebateInfo: {
salesPrice: "{{salesPrice}}",
rebatePercent: "{{rebatePercent}}",
maxUnits: "{{maxUnits}}",
}
},
});
/*
* action: seller login
* description: fire whenever a seller logins in (not signs up)
* url: https://rebaid.com/login
* notes:
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "seller.login",
eventName: "Seller Login",
data: {
userInfo: {
userId: "{{userId}}", // The seller's user id
companyName: "{{companyName}}", // The seller's company name
emailAddress: "{{emailAddress}}", // The seller's email address
}
},
});
/*
* action: seller signup
* description: fire whenever a new seller signs up for the first time
* url: https://rebaid.com/sign_up/seller
* notes:
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "seller.signup",
eventName: "Seller Signup",
data: {
userInfo: {
userId: "{{userId}}", // The seller's user id
companyName: "{{companyName}}", // The seller's company name
emailAddress: "{{emailAddress}}", // The seller's email address
}
},
});
/*
* action: shopper login
* description: fire whenever a shopper logins in (not signs up)
* url:https://rebaid.com/login
* notes:
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "shopper.login",
eventName: "Shopper Login",
data: {
userInfo: {
userId: "{{userId}}", // The shopper's user id
emailAddress: "{{emailAddress}}", // The shopper's email address
}
},
});
/*
* action: shopper offer redemption
* description: fire whenever a shopper redeems an offer
* url: https://rebaid.com/offer_redemption/10038/step-2/153352
* notes:
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "redeemOffer",
eventName: "Redeem Offer",
data: {
userInfo: {
userId: "{{userId}}", // The shopper's user id
emailAddress: "{{emailAddress}}", // The shopper's email address
rebatesRedeemed: "{{rebatesRedeemed}}" // The total rebates redeemed by the user, include status paid & pending payment
},
campaignInfo: {
sellerUserId: "{{sellerUserId}}",
campaignId: "{{campaignId}}",
campaignName: "{{campaignName}}",
campaignStore: "{{campaignStore}}", // Amazon, Walmart, etc
},
rebateInfo: {
rebateAmount: "{{rebateAmount}}",
rebateType: "{{rebateType}}" // check or direct deposit
}
},
});
/*
* action: shopper signup
* description: fire whenever a new shopper signs up for the first time
* url: https://rebaid.com/sign_up/shopper
* notes:
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "shopper.signup",
eventName: "Shopper Signup",
data: {
userInfo: {
userId: "{{userId}}", // The shopper's user id
emailAddress: "{{emailAddress}}", // The shopper's email address
}
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment