Hey, I implemented the below code under the custom code editor in the rule but I am not able to get the value for the "Product Quantity" in the network call, it's coming as undefined in the network call.
What might be the issue?
s.events = apl(s.events, "scView");
s.linkTrackVars = "events,products";
s.linkTrackEvents = "scView,purchase";
s.products = ";"+ _satellite.getVar('Product Id') + ";" +_satellite.getVar('Product Quantity') + ";" +_satellite.getVar('Product Price')
Topics help categorize Community content and increase your ability to discover relevant content.
Even if you manage to send the quantity on your "Shopping Cart View" the data will be ignored... Quantity only applies to hits with the purchase event.
It's possible that Launch (AppMeasurement) is removing it during the beacon bundling because it's not a valid field in this context (but that seems unlikely).... Same with Product Price... these are only relevant on purchases... this is the data that builds your revenue metric...
if you have a product at $5.00 and the quantity is 3, then your revenue will increment by $15 (3 x 5). On anything other than a purchase you will be counting money as made that hasn't been made, and then when you send it on purchase, you will be double/triple/etc over counting the revenue depending on how many times the user opens their cart (which is why Adobe will just ignore these values during processing, regardless of if they are sent or not)
That said, if only quantify is undefined then you might want to check your Product Quantity data element... but again, fixing this context is a moot point....
For more information about Products, please see https://experienceleague.adobe.com/docs/analytics/implementation/vars/page-vars/products.html?lang=e...
Now, if you really want to see interim values for quantity and how much money is sitting in the cart, then I suggest you set up some merchandising eVars for this purpose... and if your Data Element isn't working, you will still need to investigate what is causing it to fail.
I would start by opening your cart, opening your console and running this:
Then you will be able to see what this data element is returning, then start digging into debugging your data element.
Hey @Jennifer_Dungan as you see I have also included the " _satellite.getVar('Product Id')" & "_satellite.getVar('Product Price')" in the code and these are also being passed via Data Elements, and I am getting the value's of "Product Id" & "Product Price" in the cart view but not the Product Quantity.
I guess Product Quantity reflects only along with s.purchase event and not in scView or scOpen.
In general, Analytics will only report on Units (product quantity), Revenue (product quantity x product price) and Orders/Transactions with the "purchase" event.
If you need to report on product quantity and product revenue at other ecommerce steps, then you will need to track them to your own success events. Then, modify your s.products string accordingly.
For example, if you've setup event10 to track product quantity and event11 to track product revenue, then your s.products string at the non-purchase ecommerce steps would be:
s.products = ";"+ _satellite.getVar('Product Id') + ";;;event10=" + parseInt(_satellite.getVar('Product Quantity'), 10) + "|event11=" + parseInt(_satellite.getVar('Product Quantity'), 10) * parseFloat(_satellite.getVar('Product Price'));
As I said, you will have to check IF Product Quantity is even being set properly... but regardless, as both myself and @yuhuisg said, Price and Quantity only apply when the purchase event is fired... scView and scOpen don't, and shouldn't, report on revenue information (because you haven't yet made that money).
@yuhuisg has a good illustration of what I mentioned as well, using your own custom merchandising dimensions and metrics to track values outside of the purchase event.