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?
1) addToCart
2) addToWhislist
3) InitiateCheckout
4) addPaymentInfo
5) PlaceOrder
6) Current User Info/Sign Up
7) viewContent
Copy dataLayer.push({
'event': 'addToCart',
'ecommerce': {
'currencyCode': currencySymbol,
'add': { // 'add' actionFieldObject measures.
'products': [{ // adding a product to a shopping cart.
"name": product.name,
"id": sku,
"price": product.storePrice,
"brand": product.brand,
"category": product.categories.join('/'),
"quantity": quantity,
}]
}
}
});
2. addToWhislist
Copy dataLayer.push({
'event': 'addToWishlist',
'ecommerce': {
'currencyCode': currencySymbol,
'add': { // 'add' actionFieldObject measures.
'products': [{ // adding a product to a shopping cart.
"name": prod.name,
"id": prod.sku,
"price": prod.storePrice,
"brand": prod.brand,
"category": prod.categories.join('/')
}]
}
}
});
3. InitiateCheckout
Copy dataLayer.push({
'event': 'checkout',
'ecommerce': {
'checkout': {
'actionField': { 'step': 1, 'option': 'initiateCheckout' },
'products': [{
name: product.name,
id: product.sku,
price: product.storePrice,
brand: product.brand,
category: product.categories.join("/"),
quantity: quantity
},
{
name: product.name,
id: product.sku,
price: product.storePrice,
brand: product.brand,
category: product.categories.join("/"),
quantity: quantity
}]
}
}
});
4. addPaymentInfo
Copy dataLayer.push({
'event': 'checkoutOption',
'ecommerce': {
'checkout_option': {
'actionField': { 'step': 2, 'option': 'addPaymentInfo' }
}
}
});
5. Place order
Copy dataLayer.push({
'event': 'transaction',
'ecommerce': {
'purchase': {
'actionField': {
'id': data.numId, // Transaction ID. Required for purchases and refunds.
'currency': data.currency,
'affiliation': storeName,
'revenue': data.billing.invoice.total, // Total transaction value (incl. tax and shipping)
'tax': data.billing.invoice.tax,
'shipping': data.billing.invoice.shipping,
},
'products': [{
"name": product.name,
"id": product.sku,
"price": product.storePrice,
"brand": product.brand,
"category": product.categories.map(x => x.name).join("/"),
"quantity": quantity
},
{
"name": product.name,
"id": product.sku,
"price": product.storePrice,
"brand": product.brand,
"category": product.categories.map(x => x.name).join("/"),
"quantity": quantity
}]
}
}
});
6. Current User Info/Sign Up
Copy dataLayer.push({
'user': {
email: user.email,
name: user.name,
phone: user.countryCode + user.phoneNumber,
tnc: true
}
});
7. ViewContent
Copy dataLayer.push({
'ecommerce': {
'detail': {
'products': [{
'name': prod.name,
'id': prod.sku,
'price': prod.storePrice,
'brand': prod.brand,
'category': prod.categories.map(x => x.name).join('/'),
}]
}
}
});