New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ecommerce: recording multiple purchase items with the same sku but different values #10896
Conversation
Piwik 3.0.0-b3 release
Hmm.. not very familiar with the submission procedure on Github. In summary we are recording multiple purchase items with the same sku but different values on our site (these represent bets with different stakes on the same event). Consequently we need to permit an ecommerce request with multiple entries. As you can see, using an object with the sku as a key does not really work with this model but as it happens we can easily switch ecommerceItems to an array as the sku is also held in the item member. |
if (!isDefined(ecommerceItems[sku][1])) { | ||
ecommerceItems[sku][1] = ""; | ||
if (ecommerceItems.length) { | ||
ecommerceItems.forEach(function(ecommerceItem) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.forEach might not be supported in all browsers, the tracker is supposed to work even in older browsers. Can you maybe rewrite it to use a plain for loop?
Done, what are your guidelines for browser support? Array.prototype.foreach seems to be covered by everything: http://kangax.github.io/compat-table/es5/#test-Array.prototype.forEach what am I missing? Cheers, for feedback. |
We also support IE 8, IE7, IE6 ,... |
I also gave this a try few months ago in https://github.com/piwik/piwik/pull/10297/files but then realised it is not that simple because At the moment in Piwik the Tracking API backend does expect at most one product with a given SKU, as there is a |
If someone ever wants to work on this please re-create the PR and we can help with reviews etc. For us it's not a priority at this time |
Please issue pull request against the
3.x-dev
branch only.Piwik 2 is in LTS mode. This means we do not accept any pull request for 2.x except critical security bugs and major data loss bugs.
If you need to create a pull request for 2.x, then please also create the pull request against the
3.x-dev
so we can merge both.Happy hacking!