List referer for a specific page

I am trying to get a list of Referers for a specific page, listing the full URL and and preferably sorted on the number of visitors that accessed the page from that particular refering URL.

From ticket #756 I understand, this can only be accomplished using the API. I have tried this, using something along the lines of this:

https://[…]/index.php/?module=API&token_auth=[…]&method=Referers.getWebsites&expanded=1&idSite=1&period=day&date=today&format=xml&url=https://[…]/specific-page

However, I am not sure what method I should use. The documentation tells me Referers.getWebsites returns referrer websites (along with the full Referrer URL if the parameter &expanded=1 is set). This is not specific for a page it seems, and it lacks the additional variable for url like the one Referers.getKeywordsForPageUrl has.

So, what method should I be using if I want to list the referers for a specific page?

You need to “segment” getWebsites only to visitors that have “entered the give page URL ie. entryPageUrl”, using segmentation feature: Segmentation - Compare segments of visitors - Analytics Platform - Matomo

That’s seems a viable approach. However:

  1. pageUrl is a valid action for segmentation according to the documentation, but using it gives “Segment ‘pageUrl’ is not a supported segment.”. I am running Piwik version 1.5.1.

  2. I have constructed another URL, as quoted below, but it yields no results. This may be because I am using entryPageUrl instead pageURL because of 1), but I assume I am still doing something else wrong here.

“https://[…]/index.php/?module=API&token_auth=[…]&method=Referers.getWebsites&expanded=1&idSite=1&period=month&date=2011-09-01&format=xml&segment=entryPageUrl==https%3A%2F%2F[…]%2F[…]%2F”

  1. pageUrl only works if you use the latest beta (but wait a few days for stable)

for keywords however you only need use entryPageUrl segment

  1. if you definitely have some keywords for your selected entryPageUrl then it should work?

Ok, it’s clear why pageUrl is not working.

As for your second comment, I am not sure what “keywords” are about. I am not attempting to get a list of keywords for a specific page. I want to retrieve a list of referring websites (or better yet, pages on those websites) for a particular page. So, what other pages on what websites brought visitors to a particular page on my website?

From the documentation, I presume this would to that trick:

“https://[…]/index.php/?module=API&token_auth=[…]&method=Referers.getWebsites&expanded=1&idSite=1&period=month&date=2011-09-01&format=xml&segment=entryPageUrl==https%3A%2F%2F[…]%2F2011%2F08%2F13%2F[…]%2F”

However, this returns an empty list:

<?xml version="1.0" encoding="utf-8" ?>

And that’s it. So, what is it I am overlooking?

Try without https ?

To debug, check if URL you are looking up is found in your table piwik_log_action (SELECT * FROM piwik_log_action where name=‘http://ex.com’)

Happy New Year! If you are still using Piwik and interested in the awesome new feature of “Creating a Custom Segment in Piwik and apply to reports in Real time!” we need YOUR help, with a little or big donation at: http://crowdfunding.piwik.org/custom-segments-editor/

This will allow to dynamically add or edit, a new set of rules for example “Show all visitors from USA and using Firefox and using Google”. This will be done via a simple to use interface. See screenshots and more info here: http://crowdfunding.piwik.org/custom-segments-editor/

We are crowd funding the future of Piwik and this feature in particular. With your help we can do it.

Thanks

Matthieu