Hello,
I had tracking Contents in tags for some elements with
data-track-content data-content-name="events views" data-content-piece="XX"
I have the good statistics in my Matomo (see image)
I want to give datas with the API ?!?
I can extract datas of the contentName “events views” or of the contenPieces BUT I would like to have the data as in Matomo :
contentName “event views” and inside, the numbre for each contentPiece :
For ex., an array : myArray[contentName][contentPieces]
Thanks.
Teddy
I find the solution :
I must NOT use a simple " Reporting API request" BUT a “Report Metadata API Methods”.
See : https://developer.matomo.org/api-reference/reporting-api-metadata
It’s logic because it’s not simply a request to one table but a request with junction of tables …
Example for datas of all ‘contents’ in 1 year :
https://pathToMatomo/index.php?method=API.getProcessedReport&module=API&idSite=1&date=2019-08-24,2020-08-24&period=range&apiAction=getContentNames&apiModule=Contents&flat=1&format=JSON&token_auth=anonymous
Rem : Raw data are in the object ‘reportData
’.
Kind regards.
Teddy