Adding a new specific variable by/for pugin


I want to create specific variable for an external.

I want to send 2 parmeters : $surveyid as integer and $responseid as integer.

I create easily the 2 columns in visit log table using something like matomo/ExampleVisitDimension.php at 3.x-dev · matomo-org/matomo · GitHub .

But now i want to get it via custom parameter in API.
But here : don’t know exactly how to do …

If i just try _paq.push(['surveyis', 42]); : i receive js error (trying to use this sample Common::getRequestVar('myCustomTrackingParam', 'default', 'string', $request->getParams());)

To add something : i search on piwik.js : found setCustomData, then i try
_paq.push(['setCustomData','surveyid', 42]);

OK, data is sent as json. Then i think i can get if via json, find if surveyid is set in json and update it …

But : maybe there are a best method ? setCustomData seems undocumented, then out of API.

My question is
What i the best method to add API param for specific plugin ?


OK, get it. I make a pull request to add it in example when i found time.

Thank you :slight_smile:

You Should use customDimensions for this: Custom Dimensions User Guide - Analytics Platform - Matomo


I already use CustomDimension manageable by administrator .

And i need to put link on the other tool (see screenshot)

The system is here :
Can surely be improved, but it work …