Created
December 7, 2020 16:46
-
-
Save kmclaugh/c2d3ef3e17bd2edb011db7ba0e430c1a to your computer and use it in GitHub Desktop.
Credit purchase datalayer for flikshop
This file contains hidden or 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
// An example of what needs to be pushed to the datalayer when the user buys flikshop credits on the web app | |
// We want to treat the 1, 10, 20 credit options as individual products. | |
// The example below show what to push to the datalayer for the "10 Flikshop for $8.90" option. | |
window.dataLayer = window.dataLayer || []; | |
window.dataLayer.push({ | |
event: 'purchase', | |
ecommerce: { | |
currency: 'USD', | |
value: 8.90, // Total revenue for the tansaction | |
tax: 0.00, // I think we don't have tax, correct? | |
shipping: 0.00, | |
affiliation: 'Flikshop', | |
transaction_id: '123456', // The transaction id for the purchased from the app's DB. | |
items: [{ | |
item_name: '10 Flikshop for $8.90', // The option's name | |
item_id: 'ABC123', // The Id of the option that you use in your app's DB. If that's not aviable let's make one up that makes sense | |
price: '8.90', // The price | |
item_brand: 'Flikshop', | |
item_category: 'Credits', | |
quantity: '1', // This should always be 1 because a each purchase level is a single product | |
number_of_credits: '10' // This will be the actual number of credits purchased, ie 1, 10, or 20 | |
}] | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment