0

I have written data layer on my PDP and Cart pages in the below format to use in Adobe DTM for Adobe Analytics.

<script>
var datalayer = {
transaction: {
transactionID: “<Transaction-ID>”,
zipCode: “<Zipcode>”,
paymentMethod: “<Payment Type>”,
shippingMethod: “<Ship-Method>”,
shippingCity: “<City>”,
shippingState: “<State>”,
total: { 
basePrice: <base-amount>,
},
item: [{
productInfo: {
productName: " <product-name> ", 
productID: "<product-id>",
productCategory: “<product-category>”,
producQuantity: <Quantity>,
basePrice: <Price>,
}, 
},
{
productInfo: {
productName: " <product-name> ",
productID: "<product-id>",
productCategory: “<product-category>”,
producQuantity: <Quantity>,
basePrice: <Price>,
}, 
]}
}
};
</script>

I want to reuse the same data layer for GA enhanced e-commerce tracking. I went to GTM help and they have defined a certain format for data layer for GTM. Could please help how to achieve enhanced e-commerce tracking using the above code.

  • 1
    okay, so in principle you are essentially asking how to copy one variable to another, e.g. `a='foo';b=a;` What specifically do you need help on? What have you actually tried? – CrayonViolent Mar 24 '17 at 17:51
  • Hi @CrayonViolent , I am bit confused on the google analytics side. As I have never worked on Google Analytics Enhanced Ecommerce implementation earlier, I just wanted to know is there any way in GTM so that I can use these JSON object directly without creating new data layer specific for enhanced e-commerce. I just don't want to copy variables again for GTM. I don't want to create a data layer again what mentioned in GTM help link - https://developers.google.com/tag-manager/enhanced-ecommerce – Deepak Kumar Mar 28 '17 at 06:46
  • You can create a new variable (Custom JS type) within GTM and use that as the source. It's mentioned in the last section on the page you linked: https://developers.google.com/tag-manager/enhanced-ecommerce#macro You'd then map your current data layer to enhanced ecommerce format, as @CrayonViolent mentioned. – MisterPhilip Mar 28 '17 at 16:41
  • Thanks, @MisterPhilip . I missed the last section. :) – Deepak Kumar Mar 31 '17 at 06:54

0 Answers0