Sending custom variables using the HTTP API

While connecting my own data collection endpoint to PiwikPro via HTTP API I saw the examples at https://developers.piwik.pro/en/latest/tracker/http_api.html#/paths/~1ppms.php/get that show how to use the _cvar and cvar parameters.

I am confused by the fact that the value should be a stringified JSON object but the examples use comma delimited lists like

1,AspectRatio,16:9,2,Height,1080,3,Width,1920

values sent in this strange format do not appear in the Tracker-Debugger. I tried the example and a mor simple one like 1,debugHttpApi,on in some test hits but I had to change the format (as expected) to JSON. I used {"1":["debugHttpApi","on"]} or
%7B%221%22%3A%5B%22debugHttpApi%22%2C%22on%22%5D%7D to be precise in order to to see something coming through.

Is this just a simple error in the documentation or am I missing something here?

2 Likes

Hey @mbaersch thanks for pointing this out. It’s an error in the documentation. The team is fixing it. I will let you know once this gets updated.

2 Likes

@mbaersch this has been updated. Thanks again for your contribution & have a great weekend.

PS. you might want to hard refresh if you still see the old version.

1 Like

wow, that was fast! :wink:

1 Like

@mbaersch please remember that custom variables are deprecated and it’s recommended to use custom dimensions instead.