Retrieving custom dimension data on events via the reporting API


I’d like to make a query about event tracking with the free version of Piwik. When making API requests, I can pull event data for a specific event which brings back a total number of occurrences of that event, e.g. the number of times a button has been clicked. However, I’d like to record the timestamp of each button click so that the retrieved event data can be visualised for a given time period.

I’ve looked into using custom dimensions for recording extra variables (using the custom dimension plugin). So far, I’ve been able to store the timestamp in a custom dimension along with the trackEvent, but I am having difficulty retrieving my data with this extra parameter using the reporting API.

My query URL path begins like this: ?module=API&method=Events.getAction&idSite=1&period=month&date=yesterday&segment=eventAction==test-view-333&segment=eventName==10

Here is the raw data returned:
[0] => Array
[label] => test-view-333
[nb_visits] => 1
[nb_events] => 35
[nb_events_with_value] => 35
[sum_event_value] => 35
[min_event_value] => 1
[max_event_value] => 1
[sum_daily_nb_uniq_visitors] => 1
[avg_event_value] => 1
[segment] => eventAction==test-view-333
[idsubdatatable] => 1

As you can see, 35 of these specific events have occurred and my aim is to retrieve the full expansion of these results, each event coupled with their respective timestamps.

Any help would be greatly appreciated.

Kind regards,


EDIT: Forgot to add my event tracker code:
_paq.push([‘trackEvent’, ‘test-category’, ‘test-view-333’, 10, 1, {dimension2: ‘1456298006’}]);

Hi, for this you have to request same segment, but for Dimensions report, so method of CustomDimensions.getCustomDimension.


Thank you mgonera, this answers my question! Just to clarify, I modified the query to include the following:


This pulls out all events after the specified unix time.

  • Nathan

That’s crafty solution! Thanks for sharing @nathan!

But what if i want to get another dimension that i set with it e.g on dimension2?