Display the top 10 links visited by a UserID sorted by most active

I’m still new to Piwik/Matomo and started working my way through the API docs. I didn’t see this as part of the standard reporting, so thought I’d post here.

Don’t know if this is possible, but I’d like to display or generate a list of 10 links that were visited by a specific UserID. These links would be ordered with the most visited links links at the top.

We’d like to offer this feature to our users as an additional navigation aide. Our users can easily access this list of links and the top link is the link they visit the most. Would be nice if I could filter out links as well.

This this feasible from the API?

-RB

PS - We only use this tracker behind the user authentication, so we do set the UserID and a custom variable called Company after the user logs into the site.

<script type="text/javascript">
  var _paq = _paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
  _paq.push(["setCookieDomain", "*.redneckbob.com"]);
  _paq.push(["setDomains", ["*.redneckbob.com","*.goats.redneckbob.com","*.cows.redneckbob.com","*.redneckbob.com","*.goats.redneckbob.com","*.cows.redneckbob.com"]]);
  _paq.push(["enableCrossDomainLinking"]);
  _paq.push(["setUserId", "chickenuser"]);
  // you can set up to 5 custom variables for each visitor
  _paq.push(["setCustomVariable", 1, "Company", "RedGoats", "visit"]);
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//stats.redneckbob.com/piwik/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript><p><img src="//stats.redneckbob.com/piwik/piwik.php?idsite=1&rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

PS - we are willing to pay if someone would like to figure this out for us :moneybag:

Hi,

I haven’t tested it but this may solve your issue:

You can use segmentation to filter the result of an API by an parameter.
https://developer.matomo.org/api-reference/reporting-api-segmentation

https://demo.matomo.org/?module=API&method=Actions.getPageUrls
&idSite=7&period=day&date=today&format=JSON&token_auth=anonymous
&filter_limit=10&segment=visitCount>2

This filters the list of the 10 most visited page by the people who visited more than twice.
The same should work with filtering by Visitor ID:

&segment=visitorId==chickenuser

PS: Using the tracking data to show each user their most used pages is a really nice idea.

@RedneckBob, did you have time to look into my solution?

Thanks Lukas, just saw your post and will give it a try ASAP.