Querying reporting API to get campaigns and page urls


#1

We’re trying to get the campaign names that referred all pages (page urls) within a certain timeframe. We were looking at the Actions.getPageURLs call, which works great except that it doesn’t return campaign names. Anyone knows how to get both data points returned on the same response?

Here’s the call we’re currently using:

http://demo.piwik.org/?module=API&method=Actions.getPageUrls&idSite=7&period=day&date=today&format=JSON&token_auth=anonymous


{
label: “/index”,
nb_visits: 156,
nb_uniq_visitors: 152,
nb_hits: 190,
sum_time_spent: 5576,
nb_hits_with_time_generation: “174”,
min_time_generation: “0.001”,
max_time_generation: “5.482”,
entry_nb_uniq_visitors: “136”,
entry_nb_visits: “139”,
entry_nb_actions: “917”,
entry_sum_visit_length: “35628”,
entry_bounce_count: “32”,
exit_nb_uniq_visitors: “40”,
exit_nb_visits: “40”,
avg_time_on_page: 36,
bounce_rate: “23%”,
exit_rate: “26%”,
avg_time_generation: 0.29,
url: “http://forum.piwik.org/
},

The url is there but no campaign name

Thanks


(Matthieu Aubry) #2

call the API to get the campaign names instead,

and pass a segment to select only the visitors that you want to get campaigns for: Segmentation - Compare segments of visitors - Analytics Platform - Matomo


#3

Hey Matt, thanks for your feedback, so if I understand correctly, there’s no way to do this with a single call? It would always require two calls?

Any other ideas how I could get campaign names + label + visits with a single call?

Thanks