Mostview Feed with custom parameters


#1

Hi,

To my site (big site with Varnish cache), I need get the most view contents of the day. I use piwik to track, thus:


<script type="text/javascript">
... [others codes here] ...
_paq.push(["setCookieDomain", "*.dev.mysite.com"]);
_paq.push(["setCustomVariable", 1, "title", 'Title of my content', "page"]);
_paq.push(["setCustomVariable", 2, "entry_id", 'ID of my content', "page"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
... [others codes here] ...
</script>

And to capture the results, I use REST (Actions.getPageUrl):

http://piwik.mysite.com/?module=API&method=Actions.getPageUrls&idSite=1&period=day&date=today&format=json&token_auth=anonymous&flat=1&segment=pageUrl=@/news/&filter_sort_column=nb_hits&showColumns=nb_hits

And the result is almost perfect:


[
    {
        "label": "news/blahblah/article-url-here",
        "nb_hits": 27,
        "url": "http://mysite.com/news/blahblah/article-url-here"
    },
    {
        "label": "news/blahblah/article-url-here",
        "nb_hits": 17,
        "url": "http://mysite.com/news/blahblah/article-url-here"
    },
    {
        "label": "news/blahblah/article-url-here",
        "nb_hits": 10,
        "url": "http://mysite.com/news/blahblah/article-url-here"
    }
]

The problem is: I need “title” and “entry_id” (custom variables) in this report.

Is possible?

Thank you


(Matthieu Aubry) #2

Unfortunately not possible yet (until we implement Custom Reports / Pivot table with selectable dimension · Issue #4776 · matomo-org/matomo · GitHub )

Now what you can do is create custom segment for each page URL, and then request the Custom Variable report for each segment. This will work as you expect!


#3

Thank you very much, Matt.

Regards
Rafael