I have code on our eCommerce site that creates an array for the product(s) that are being purchased, it runs through a for-each loop and adds the following to an array for each product, which is sent to SiteCatalyst:
I am taking this code and trying to re-purpose it using Tealium and the eCommerce extension. My question is how does the eCommerce extension create the array it uses for products and what changes (if any) do I need to make to the way my code gathers the product data? Should I be making an array of just category, then just skus, the just prices...etc?
The SiteCatalyst product string will be created automatically for you within our SiteCatalyst Tag Template. You are on the right track with your last question.
In order to for the eCommerce ext to work you will need an array of product ids, an array of product_names, an array of product quantities, etc.
So you will have something similar to this on your page:
product_id = ["123456"],
product_quantity = ["1"],
product_unit_price = ["12.99"];
product_category = ["catA"];
Then in the eCommerce extension you will select the variable arrays defined in each of the drop down lists.
Our tag template will then loop through each value in the defined product variables and create the string like so:
s.products = catA;123456;1;12.99;;
If you have multiple products make sure they are all different values within the array:
i.e. product_id = ["12345","67890"]
Hope this helps!