Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics - less than n minutes ago

Google Analytics Realtime provides rt:minutesAgo, on which one could filter queries.

However, it being a dimension and not a metric, <= cannot be used in the filter.

Assuming I want to get some numeric metric (like rt:totalEvents) for the last n minutes, what would be the best way to do this?


Currently, the only idea that I have is to create a regex, which matches numbers <= n, use =~ and then sum all rt:totalEvents in the result set. This sounds wrong on so many levels.

like image 790
ndnenkov Avatar asked Feb 19 '16 13:02

ndnenkov


People also ask

What is minute index in Google Analytics?

Minute Index is a Dimension in Google Analytics under the Time section. Minute Index Definition: The index for each minute in the specified date range. The index for the first minute of the first day (i.e., start-date) in the date range is 0, for the next minute 1, and so on.

How do I compare two periods in Google Analytics?

To compare two different date ranges: Select the Compare to checkbox, then select Custom, Previous Period, or Previous Year. Use the controls to set the second date range. Click Apply.

How does Google Analytics calculate peak time?

To view the most busiest days, first choose the date range and then navigate to Audience >> Overview. On the graph click on the day button to view daily traffic.

What is minute dimension?

The 'Minute' dimension reports the minute that a given metric occurred (rounded down). The first dimension item is the first minute in the date range, and the last dimension item is the last minute in the date range.


1 Answers

As I understand it, minutesAgo is a time dimension and could not be a metric because it could not be aggregated in any inherently default way.

Imagine you drilldown by country (dimensions=rt:country)... and there are N visitors from one country that hit your site in the last 10 minutes. What would the value of minutesAgo be? the average? the latest?

Metrics need to be aggregate-able for them to be metrics. Time values in OLAP databases tend not to have this property (inherently), hence they are better modelled as dimensions (usually by periods: "day", "week"... or in this case "minutesAgo").

As mentioned by @Pete, in this case you can still apply a long combination of filters (or a regexp) and use totalsForAllResults:

"totalsForAllResults": {
  "rt:totalEvents": "2"
 },
like image 160
jjmontes Avatar answered Nov 29 '22 12:11

jjmontes