Enough people have asked for an example of a products string that I decided to post my example page on my server.
On the example page, you can see:
- How to build a W3C-standard data layer object for a cart with multiple items
- How to create a simple s.products string
- How to create more elaborate s.products strings, including merchandising eVars.
- What the final beacon looks like.
I hope someone out there finds it helpful!
Hi Jennifer,
Thanks for the blog post about the s.products string in DTM. I noticed at the end of the products string for multiple products there is an extra comma. Does this cause any errors in adobe ? In my implementation I modified your code a little to remove the comma. Thought id share.
var product_line=”;”+prodSku+”;”+prodQuantity+”;”+prodPrice+”;;eVar8=”+prodMethod
if (i == 0)
s.products = product_line;
else
s.products += “,” + product_line;
The extra comma shouldn’t cause any problems in reporting, but it does look sloppy.
Thanks for the code, I’ll try to incorporate that sometime soon!
Hello Jenn, Is there a possibility that you could fix the example page please?
Oh, apparently the link had changed over the years- the page is still up at working, I just needed to update the link to http://www.digitaldatatactics.com/examples/products.html. Hopefully that helps.