Google Tag Manager
It is a tag management system that allows you to quickly & easily update measurement codes & related code fragments collectively known as tags on your website or mobile app. When Tag Manager is installed on your website or app will be able to communicate with the Tag Manager servers. You can then use Tag Manager's web-based user interface to set up tags, establish triggers that cause your tag to fire when certain events occur, and create variables that can be used to simplify and automate your tag configurations. How To Do Google Tag Manager Setup? 1. Click on Store Preferences->Analytics.
2. Enter the Google Tag Manager ID.
What are the various events? a) addToCart b) addToWhislist c) InitiateCheckout d) addPaymentInfo e) PlaceOrder
    1.
    addToCart
1
dataLayer.push({
2
'event': 'addToCart',
3
'ecommerce': {
4
'currencyCode': this.currencySymbol,
5
'add': { // 'add' actionFieldObject measures.
6
'products': [{ // adding a product to a shopping cart.
7
"name": product[0].product.name,
8
"id": sku,
9
"price": product[0].product.storePrice,
10
"brand": product[0].product.brand,
11
"category": product[0].product.categories.join('/'),
12
"quantity": product[0].quantity,
13
}]
14
}
15
}
16
});
Copied!
2. addToWhislist
1
dataLayer.push({
2
'event': 'addToWishlist',
3
'ecommerce': {
4
'currencyCode': this.currencySymbol,
5
'add': { // 'add' actionFieldObject measures.
6
'products': [{ // adding a product to a shopping cart.
7
"name": this.prod.name,
8
"id": this.prod.sku,
9
"price": this.prod.storePrice,
10
"brand": this.prod.brand,
11
"category": this.prod.categories.join('/')
12
}]
13
}
14
}
15
});
Copied!
3. InitiateCheckout
1
dataLayer.push({
2
'event': 'checkout',
3
'ecommerce': {
4
'checkout': {
5
'actionField': { 'step': 1, 'option': 'initiateCheckout' },
6
'products': data.items.filter(x => !x.autoAdd).map(x => ({ name: x.product.name, id: x.product.sku, price: x.product.storePrice, brand: x.product.brand, category: x.product.categories.join("/"), quantity: x.quantity }))
7
}
8
}
9
});
Copied!
4. addPaymentInfo
1
dataLayer.push({
2
'event': 'checkoutOption',
3
'ecommerce': {
4
'checkout_option': {
5
'actionField': { 'step': 2, 'option': 'addPaymentInfo' }
6
}
7
}
8
});
Copied!
5. Place order
1
dataLayer.push({
2
'event': 'transaction',
3
'ecommerce': {
4
'purchase': {
5
'actionField': {
6
'id': data.numId, // Transaction ID. Required for purchases and refunds.
7
'affiliation': storeName,
8
'revenue': data.billing.invoice.total, // Total transaction value (incl. tax and shipping)
9
'tax': data.billing.invoice.tax,
10
'shipping': data.billing.invoice.shipping,
11
},
12
'products': data.items.map(x => ({
13
"name": x.product.name,
14
"id": x.product.sku,
15
"price": x.product.storePrice,
16
"brand": x.product.brand,
17
"category": x.product.categories.map(x => x.name).join("/"),
18
"quantity": x.quantity
19
}))
20
}
21
}
22
});
Copied!
Last modified 3mo ago
Copy link