Quick API question about referers


#1

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

Kev


(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


#3

Sorry,

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

http://www.mydomain.com/piwik/?module=API&method=Actions.getPageUrl
&idSite=1&period=range&date=2011-05-30,2011-06-06
&pageUrl=http://www.mydomain.com/kids/bikes/
&format=PHP&filter_limit=20
&token_auth=xxxxxxx

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