We are trying to implement these DATATRICS scripts within Magento 1.9.4.
The scripts are provided as static: my problem is that I cannot identify the exact magento variables to be specified in the scripts to make them "dynamic"
Could you help me by indicating the exact "dynamic" values?
Is there a list of values on the web? Where can i get them?
The values should be replaced instead of "NAME", "SKU" ..etc and instead of the numeric (static) values declared in the example scripts.
Thanks to those who will be able to help me
// add the first product to the order
_paq.push(['addEcommerceItem',
"SKU", // (required) SKU: Product unique identifier
"NAME", // (optional) Product name
"CATEGORYNAME", // (optional) Product category. You can also specify an array of up to 5 categories eg. ["CATEGORYNAME", "CATEGORYNAME2", "CATEGORYNAME3"]
20, // (recommended) Product price
1 // (optional, default to 1) Product quantity
]);
// Here it is important to add all other products found in the order
// Specifiy the order details
_paq.push(['trackEcommerceOrder',
"ORDERID", // (required) Unique Order ID
10.70, // (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)
5.5, // (optional) Order sub total (excludes shipping)
5.5, // (optional) Tax amount
5.5, // (optional) Shipping amount
false // (optional) Discount offered (set to false for unspecified parameter)
]);
_paq.push(['trackPageView']);
-
// Set the view of a product
_paq.push(['setEcommerceView',
"SKU", // (required) SKU: Product unique identifier
"NAME", // (optional) Product name
"CATEGORYNAME", // (optional) Product category. You can also specify an array of up to 5 categories eg. ["CATEGORYNAME", "CATEGORYNAME2", "CATEGORYNAME3"]
20, // (recommended) Product price
]);
// Set the view of a category
_paq.push(['setEcommerceView',
false,
false,
"CATEGORYNAME", // You can also specify an array of up to 5 categories eg. ["CATEGORYNAME", "CATEGORYNAME2", "CATEGORYNAME3"]
]);
_paq.push(['trackPageView']);
-
// Add all products found in the cart
_paq.push(['addEcommerceItem',
"SKU", // (required) SKU: Product unique identifier
"NAME", // (optional) Product name
"CATEGORYNAME", // (optional) Product category. You can also specify an array of up to 5 categories eg. ["CATEGORYNAME", "CATEGORYNAME2", "CATEGORYNAME3"]
20, // (recommended) Product price
1 // (optional, default to 1) Product quantity
]);
// Specifiy the order details
_paq.push(['trackEcommerceCartUpdate', 15.5]); // (required) Cart amount
_paq.push(['trackPageView']);
Please have a look at the following documentation:
https://help.datatrics.com/en/collections/1864777-tracking-scripts#ecommerce-scripts
The scripts above are better documented and it's much clearer what you need to make "dynamic".
I hope this helps! You can also chat with Datatrics by clicking on the bottom right chat bubble in this documentation.
[Edit] If you are using Google Tag Manager with Enhanced Ecommerce, it's maybe easier to implement those scripts there. There is a copy/paste script which captures all GTM Enhanced Ecommerce data and sends it over to the Datatrics tracking script.