Quick API question about referers


HI Guys,

Sorry very new to PIWIK. checked the docs and I am scratchng my head.

What I need to do is an api call that gives me the traffic sources of a particular page. Can anyone give me an example please of how I request the traffic source for a particular page over a time period?

Many thanks


(Matthieu Aubry) #2

You can use, “segment” function: Segmentation - Compare segments of visitors - Analytics Platform - Matomo
and use the entryPageUrl segment in particular, then call the Referer API for this segment, eg. &segment=entryPageUrl==ENCODED_URL_YOU_WANT_TO_SEARCH



Im still struggling maybe having a not as brainy as normal day :). Maybe if I show what I am trying to do then you can point me in the right direction.
I got everything else I need. So, soon as i crack this one. I am done :slight_smile:

This is the query used to give me views & uniques


I am trying to break these down into the traffic sources. ie if this page had 10 visits I am interested to see where the visits came from.

What would I change to this request to make it do what I need?

(Matthieu Aubry) #4

Example URL of Top countries used by visits landing on the page: http://www.virtual-drums.com/: http://demo.piwik.org/?module=API&method=UserCountry.getCountry&idSite=3&date=yesterday&period=day&format=xml&filter_truncate=5&language=en&segment=entryPageUrl==http%3A%2F%2Fwww.virtual-drums.com%2F