Skip to content


Ecommerce: Tracking multiple Product categories on an ecommerce page view does not work #2897

anonymous-piwik-user opened this Issue · 5 comments

2 participants


Piwik Version : 1.6

I've tried to use the e-commerce tracking as described in the documentation (

The documentation and that ticket (#2659) tell us that we can assign multiple categories to products, but it seems that it actually doesn't work via the piwikTracker.setEcommerceView function (JS tracker).
For example :


It results in an empty Product Category "Custom Variable value not defined".

I've activated the debug mode and i've found a first error :

Warning: substr() expects parameter 1 to be string, array given in /www/piwik/core/Tracker/Visit.php on line 1082

The error appears in the getCustomVariables and truncateCustomVariable functions.

It seems that the code is not handling arrays and assume that all custom variables are only strings.

Piwik Open Source Analytics member

(In [5777]) Fixes #2897

  • Forgot to stringify the array of categories. This wasn't covered in the tests since they use the php tracking api client.
  • Added JS tests

jeremy, it is very appreciated if you can test the new piwik.js and report if it's working for you too! thanks


I've tried the lastest version (1.7), but now the Ecommerce tracker seems not to work at all:

  • I can see the ecommerce custom variables values in the visitor log (in the bubble when we put the mouse on the url) : _pkp, _pks, _pkn, _pkc

  • I can also see them in the piwik_log_link_visit_action table, which means that they are saved

  • BUT NOW the "custom variables" page or even the "ecommerce and goals" page are empty

Piwik Open Source Analytics member

It's expected that they don't appear in the "Custom Variable" see #2755

However it's not expected that nothing works. On the demo we track ecommece and it is working (product name is tracked). What exactly is not working for you? can you put a screenshot? thx


OK I didn't see the #2755 ticket and so i thought that they will appear in the "custom variables" widget again.
Now I can see them in the ecommerce widgets so all is good!
I'm sorry for the unuseful last comment and for the waste of time ;)
However I can now confirm that tracking multiple categories is working like a charm.

Piwik Open Source Analytics member

So the conclusion is that "All" is working fine? :) that's good!!

@anonymous-piwik-user anonymous-piwik-user added this to the 1.7 Piwik 1.7 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.