Is it possible to use the Google Analytics APIs get a count of the number of times a certain event has been tracked?
More specifically, can this number be counted in such a way that each unique visitor who hits this event is counted only once (subsequent events for each unique visitor are not included in the total).
I am intending to access the API through PHP, for what it's worth.
Yes.
You'd set your dimension to be ga:eventCategory
, or ga:eventAction
or ga:eventLabel
(or two or all of them), depending on what level of the event you want to count.
You'd set your metric to be ga:uniqueEvents
, which only counts the event once per visit. (You don't have the ability to make it unique according to visitor.) For total events, you'd set it to ga:totalEvents
.
And you'd set your filter to filter down to which events you'd like to account for. For example, for events of category Foo and action Bar:
ga:eventCategory==Foo;ga:eventAction==Bar
You can test it out in the Google Analytics Data Feed Query Explorer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With