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, orga:eventActionorga: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 toga: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:
You can test it out in the Google Analytics Data Feed Query Explorer.