Setting userId throws a JS error

VersionL 2.6.1
I am trying to pass a userId from JS tracking code.
However I am getting the JS error below.
The error does not happen if I am not setting the userId.


Uncaught TypeError: Cannot read property 'apply' of undefined piwik.js:14

javascript tracking code snippet:


var _paq = _paq || [];
        _paq.push(["setCustomVariable", 2, "Session", "${session?.id}", "visit"]);
      
       _paq.push(['setUserId', 'USER_ID_HERE']);
       
       _paq.push(["trackPageView"]);
        _paq.push(["enableLinkTracking"]);

        (function () {...}

setUserId was added in Piwik 2.7.0-rc1 please download from: Index of /

Would be great if the manual said which version introduced each feature so that it makes debugging easier.

Yes sorry about that! Piwik 2.7.0 was released today!

Oh sweet! But yea, I agree with @thefoodcorp you should tell us that in the docs.

OK it is working now. However, how do I create a segment to search by user id only?
I tried this:


but no luck

yes this should work! isnt it working for you?

nope. i keep getting There is no data for this report.

but before you were getting Uncaught TypeError: Cannot read property 'apply' of undefined piwik.js:14 so it’s a different problem? see Piwik doesn’t track any visits and pages, and shows “There is no data for this report” in all reports. - Analytics Platform - Matomo