- You will first need to import the FeedOps Google Tag Manager container on your website.
- Once Google Tag Manager has been set up, log in to your Maropost Neto admin panel.
- In the left-hand menu, go to Settings & Tools > All Settings & Tools and select Analytics & 3rd Party Scripts > Custom Scripts.
- From the list of Custom Scripts, select Google Tag Manager script and click Edit. If you don't have the Google Tag Manager script, follow how to install Google Tag Manager container scripts for the Maropost Neto website guide to add it to your store.
- Scroll to the Scripts section. In the Page Header section, after the Google Tag Manager <head> script ends, paste the following snippet.
<!-- FeedOps Neto Conversion tracking v2 START-->
<script>
var dcPageType = "[@config:current_page_type@]"
dataLayer.push({'currency': "[@CONFIG:DEFAULTCURRENCY@]"});
if (dcPageType == 'product') {
var dcEvent = 'product';
var dataGaId = "[@sku@]";
var dataGaName = "[@name@]";
var dataGaPrice = "[@price@]";
var dataGaBrand = "[@brand@]";
dataLayer.push({
'event': 'DynamicRemarketing',
'ecomm_pagetype': dcEvent,
'ecomm_prodid': [ dataGaId ],
'ecomm_totalvalue': dataGaPrice,
'ecommerce': {
'detail': {
'products': [{
'id': dataGaId,
'name': dataGaName,
'price': dataGaPrice,
'brand': dataGaBrand
}]
}
}
});
} else if (dcPageType == 'category') {
dataLayer.push({
'event': 'DynamicRemarketing',
'ecomm_pagetype': 'category'
});
}
</script>
<!-- FeedOps Neto Conversion tracking v2 END-->
- In the Page Footer section, before the Google Tag Manager <body> script, paste the following snippet.
<!-- FeedOps Neto Conversion Tracking v2 START-->
[%IF [@CONFIG:CHECKOUT_COMPLETED@] eq '' and [@config:current_page_type@] eq 'checkout'%]
<script>
[%cart_items%]
[%param *header%]
var cartItems = [
[%/param%]
[%param *body%]
[%if [@count@] ne 0%],[%/if%]{
'id': '[@sku@]',
'name': '[@model@]',
'price': '[@price@]',
'brand': '[@brand@]',
'quantity': [@qty@]
}
[%/param%]
[%param *footer%]
];
[%/param%]
[%/cart_items%]
window.dataLayer = window.dataLayer || []
</script>
<script>
var dcPaynemt = dcPaynemt || false
var dcTerms = dcTerms || false
var dcBill = dcBill || false
var dcEmail = dcEmail || false
$('input').change(function() {
var dcAction = $(this).attr('name')
var dcActionField
if (dcAction.includes("_email") && !dcEmail) {
dcActionField = {'step': 1, 'option': 'Email'}
dcEmail = true
} else if (dcAction.includes("bill_") && !dcBill) {
dcActionField = {'step': 2, 'option': 'Billing'}
dcBill = true
} else if (dcAction.includes("payment") && !dcPaynemt) {
dcActionField = {'step': 4, 'option': 'Payment'}
dcPaynemt = true
} else if (dcAction.includes("agree") && !dcTerms) {
dcActionField = {'step': 3, 'option': 'Terms'}
dcTerms = true
}
if (dcActionField) {
dataLayer.push({
'event': 'GoogleAnalyticsEE',
'ga_ee_event': 'checkout',
'ecommerce': {
'checkout': {
'actionField': dcActionField,
'products': cartItems
}
}
});
}
})
</script>
[%/IF%]
<!-- FeedOps Neto Conversion Tracking v2 END-->
- In the Page Footer section, after the Google Tag Manager <body> script, paste the following snippet.
<!-- FeedOps Neto Conversion Tracking v2 START-->
<script>
$(document).ready(function() {
var ecom = {
productSetup: function(product) {
return {
'name': product.name,
'id': product.SKU ? product.SKU : product.parent_sku,
'category': product.category_fullname ? product.category_fullname : '',
'quantity': product.baseqty,
'price': product.price
}
},
addToCart: function(){
var nProduct = $.getLastItemAdded();
var product = ecom.productSetup(nProduct);
dataLayer.push({
'event': 'DynamicRemarketing',
'ecomm_pagetype': 'cart',
'ecomm_totalvalue': product.price * product.quantity,
'ecomm_prodid': [ product.id ]
});
dataLayer.push({
'event': 'GoogleAnalyticsEE',
'ga_ee_event': 'add_to_cart',
'ecommerce': {
'add': {
'products': [ product ]
}
}
});
},
addMultiToCart: function(){
var nProducts = $.getLastItemsAdded();
for (var i = 0; i < nProducts.length; i++) {
var product = ecom.productSetup(nProducts[i]);
dataLayer.push({
'event': 'DynamicRemarketing',
'ecomm_pagetype': 'cart',
'ecomm_totalvalue': product.price * product.quantity,
'ecomm_prodid': [ product.id ]
});
dataLayer.push({
'event': 'GoogleAnalyticsEE',
'ga_ee_event': 'add_to_cart',
'ecommerce': {
'add': {
'products': [ product ]
}
}
});
}
},
removeFromCart: function(){
var nProduct = $.getLastItemRemoved();
var product = ecom.productSetup(nProduct);
dataLayer.push({
'event': 'GoogleAnalyticsEE',
'ga_ee_event': 'remove_from_cart',
'ecommerce': {
'remove': {
'products': [ product ]
}
}
});
},
init: function(){
nAddItemCallbacks.push(ecom.addToCart);
nAddMultiItemsCallbacks.push(ecom.addMultiToCart);
nRemoveItemCallbacks.push(ecom.removeFromCart);
}
}
if (typeof $.getLastItemAdded !== "undefined") {
ecom.init();
}
})
</script>
<span class="ga-pagetype" data-ga-pagetype="[@config:current_page_type@]"></span>
<!-- FeedOps Neto Conversion Tracking v2 END-->
- In the Purchase Confirmation (Thank You Page) section, paste the following snippet.
<!-- FeedOps Neto Conversion Tracking v2 START-->
[%SHOW_ORDER id:'[@ORDER_ID@]'%]
[%PARAM *header%]
<script>
var dcEvent = 'purchase';
var userEmail = '[@email@]';
var firstName = '[@bill_first_name@]';
var lastName = '[@bill_last_name@]';
var street = '[@bill_street1@]';
var city = '[@bill_city@]';
var region = '[@bill_state@]';
var country = '[@bill_country@]';
var postCode = '[@bill_zip@]';
var OrderID = '[%URL_ENCODE%][@ORDER_ID@][%END URL_ENCODE%]';
var OrderTotal = '[@GRAND_TOTAL@]';
var OrderShipping = '[@shipping_price@]';
var OrderTax = '[@tax_total@]';
var dcOrderCoupon = '[@coupon_code@]';
var dcAffiliation = '[%URL_ENCODE%][@CONFIG:WEBSITE_NAME@][%END URL_ENCODE%]';
var dcProducts = [
[%END PARAM%]
[%PARAM *body%]
{
'id': '[@SKU@]',
'name': '[@MODEL@]',
'category': '[@CATEGORY_NAME@]',
'price': [@PRICE@],
'quantity': [@QTY@]
}[%if [@counter@] != [@total_items@]%],[%/if%]
[%END PARAM%]
[%PARAM *footer%]
];
dataLayer.push({
'event': 'DynamicRemarketing',
'ecomm_pagetype': dcEvent,
'user_email': userEmail,
'order_user_first_name': firstName,
'order_user_last_name': lastName,
'order_shipping_street': street,
'order_shipping_city': city,
'order_shipping_region': region,
'order_shipping_postal_code': postCode,
'order_shipping_country_code': country,
'ecomm_totalvalue': OrderTotal,
'ecomm_prodid': dcProducts.map(p => {return p.id}),
'order_id': OrderID,
'ecommerce': {
'purchase': {
'actionField': {
'id': OrderID,
'affiliation': dcAffiliation,
'revenue': OrderTotal,
'tax': OrderTax,
'shipping': OrderShipping,
'coupon': dcOrderCoupon
},
'products': dcProducts
}
}
});
</script>
[%END PARAM%]
[%END SHOW_ORDER%]
<!-- FeedOps Neto Conversion Tracking v2 END-->
To verify that your Dynamic Remarketing and Conversion Tracking works, you can follow
guides.