I have some pages with multi products on them. I want to use s.products using the data layer as mentioned at the end of the documentation https://experienceleague.adobe.com/docs/analytics/implementation/vars/page-vars/products.html?lang=e...
Right now I am using a variable called line instead of s.products in the custom code and storing the values.
This custom code I have used to create a data element and mapped it to eVar in a DOM-ready rule to trigger this eVar for each page load.
But I want to classify my products now and want to use products variable. How can I utilize s.products here?
When trying to replace the variable line (in the above screenshot) with s.products, I am getting an error in the developer console log: Uncaught ReferenceError: s is not defined
I want to understand how in the debugger I will see the product variable? How the reporting will look like?
Views
Replies
Total Likes
"s" is the Adobe Analytics AppMeasurement object, did you have your Adobe Analytics extension configured to "Make tracker globally accessible"?
Views
Replies
Total Likes
@leocwlau NO, I have not enabled this option
Views
Replies
Total Likes
Where is the code using s.products? Is it in the Data Element? I believe in most cases, the s object may not yet be initiated when the data element runs...
Normally what I do, is a use a variable, like you did (line) and populate in the values in the format the s.products uses.
Then in my actual tracking rule, in the "Set Variables", I use the custom code area there to set the s.products object:
s.products = _satellite.getVar('data element name');
Or you can set the code reading the data layer and using s.projects directly in the custom code of the Set Variables (and not use a Data Element at all).
So long as you know where that code is being set and you document this so that others on your team know it (though they can search for "s.products" in Launch), then it is fine.
Views
Replies
Total Likes
@Jennifer_Dungan Thank you. Now, I can see the Products variable populating in the debugger. But I want to confirm if it's populating data correctly?. for the pages with multi-product info in the data layer I am passing the first product category as "semicolon" separated and different products as "coma separated. Is it correct? And, in reporting in analytics will they be in sequential line format with one value in one row?
Views
Replies
Total Likes
This format isn't quite correct, and I believe if there are any issues with the products syntax, Adobe will ignore that entire variable.
It looks like you are trying to pass a list of categories for each product?
The format for each product should be:
category;product;quantity;price;events;evars
If you are using multiple events or evars, those should be pipe separated (event1|event2|event3;evar1=sdfsd|evar2=dfyyy)
If you don't need quantity, price, events or evars; then you can just use:
category;product
So for multiple products (with just category/products), it would look like:
category1;product1,category2;product2,category3;product3
You cannot pass multiple categories in this syntax.
In your sample:
Wireless; Wi-Fi; Wireless Xpress xxx;null,Wireless; Bluetooth Low Energy; Wireless Xpress yyy;null
I assume from this context that "Wireless Xpress xxx" and "Wireless Xpress yyy" are your products?
Generally speaking, if you need to pass multiple categories, you could map those using classification rules based on a SKU number (after the data is captured) or pass these using merchandising eVars.
As for how the data shows in Adobe Reporting, Adobe actually processes the data based on the expected format.. which is why any issues will cause Adobe to throw out all the data... if they don't know how to handle it, they just don't process it at all.
The "Category" item has a dimension called "Category" and the "Products" use a dimension called "Products", etc
If you use Merchandising eVars or Merchandising Events, these will be configured by you. There are also some standard product events that you can use: Purchase, scOpen, scView, scCheckout, scAdd, scRemove
Custom Events can be added just as part of s.events... these will apply globally to all the items in Products - like maybe you want to track "product impressions from search" (event1), you can just set s.events="event1"
But maybe you need to track some more specific events like "impressions in recommended items" as an extra event (event2), in this case you need to include this in BOTH the product notation and in s.events and the event needs to be set as Numeric (rather than counter)
s.events="event1,event2"
s.products="category1;product1;;;event2=1,category2;product2,category3;product3"
(only product1 will be correlated to event2, but all products will correlate to event1)
If you are going to use Merchandising eVars, you will need to configure those as merchandising, and use the product syntax:
Sorry, I'm sure there is more to cover.. this is a huge topic... but hopefully this is a good start.....
Views
Likes
Replies