Is there a way to get a list of page URLs and page titles in one API call?


#1

I’d like to display a report that lists all popular pages on the sites I’m tracking in Piwik, and the view counts for each page. For each page that is listed, I’d like to display both the page title and the page URL. That way it’s easy for viewers to understand which pages the report refers to. And they can click on a row in the report to go to that page on the site.

I can’t find any way to get both the page URLs and the page titles in one API call. Similarly, the Piwik UI has a separate report for page URLs and page titles, both under the Actions tab. And I see that these two are tracked as separate actions in the database.

Is this because the page title and page URL can change separately? If so, is my desired report a bad idea? Should I curl my site directly when I generate this report, so I can get the current page title for each URL?


#2

After looking at the database more closely, and particularly the Live plugin, I see that page titles are indeed separate from URL actions. Though they are associated together as a single link action within a specific visit.

I’m guessing the best approach here is to follow the Piwik UI and Google Analytics UI, and just display a report of page URLs. Page titles tend to be somewhat meaningless these days anyway, since a lot of times their primary goal is to improve SEO.

Even so, it would be helpful for a report of popular page URLs to display the most recent page title for each page URL. Perhaps the page title could be displayed as a tooltip, or something like that. But I now realize that the Piwik db doesn’t explicitly retain the most recent page title for each page URL.