ultimate-go | The Ultimate Go Study Guide | Learning library
kandi X-RAY | ultimate-go Summary
kandi X-RAY | ultimate-go Summary
The Ultimate Go Study Guide
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ultimate-go
ultimate-go Key Features
ultimate-go Examples and Code Snippets
Community Discussions
Trending Discussions on ultimate-go
QUESTION
I'm doing a dataLayer push for e-commerce purchases. Following the GTM guide, the product items are in an array. The issue is pulling the data: all the guides I've seen mention using an array index -- e.g. transactionProduct.1.price
to get the price for the 2nd item. But is not a robust solution: what if the user buys 100+ items? I can't hard-code the array index for this reason. So, how do I dynamically capture the properties in this case? I think I need to use the Custom JavaScript User-Defined Variable, but what would that look like (an example would be helpful)?
ANSWER
Answered 2021-Sep-24 at 18:35I believe I've figured it out:
If our dataLayer push looks like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ultimate-go
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page