Jump to content

Populate Variables for the Google dataLayer


Recommended Posts

Hi

 

We use Google Tag Manager, and need to populate ONLY two variables in the dataLayer which is to be placed on the Order Confirmation page:

 

{literal}    
<script>

dataLayer = [{
 'transactionId': 'VARIABLE HERE', // order ID - required
 'transactionAffiliation': '', // affiliation or store name
 'transactionTotal': VARIABLE HERE, // total - required
 'transactionTax': , // tax
 'transactionShipping': , // shipping

// transactionProducts is an array that needs to be populated by your ecommerce
// variables for each purchased product, where your ecommerce engine loops through
// each item in the cart and adds the variables below for each product, until all
// products are included. If you already have a loop set up for the original
// Google Analytics Ecommerce code, you should simply be able to swap out the
// dataLayer code for the old Google Analytics Ecommerce Code.

 'transactionProducts': [{
 'sku': '',
 'name': '',
 'category': '',
 'price': ,
 'quantity':
 },{

 'sku': '',
 'category': '',
 'price': ,
 'quantity':
 }]

}];

</script>
{/literal}

 

 

How would it be possible to get those variables inserted to the code above?

 

We are on PS 1.5.6.2

Link to comment
Share on other sites

  • 3 weeks later...
×
×
  • Create New...