Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GoogleAnalytics track time between events

I am using GA on an Android app but this question can be relevant to all platfroms.

I track an event the usual way:

t.send(new HitBuilders.EventBuilder()
.setCategory(getString(categoryId))
.setAction(getString(actionId))
.setLabel(getString(labelId))
.build());

Is there a way to see a report of how much time has passed between such 2 events?

like image 944
Yonatan Nir Avatar asked May 14 '15 14:05

Yonatan Nir


1 Answers

What I eventually did was tracking the time in the code and then report it like this:

long time1 = System.currentTimeMillis();
...
long time2 = System.currentTimeMillis();
long timingValue = time2 - time1;
tracker.send(new HitBuilders.TimingBuilder()
            .setCategory(timingCategory)
            .setValue(timingValue)
            .setVariable(timimngVariable)
            .setLabel(timingLabel)
            .setCustomDimension(1,1)
            .setCustomMetric(1, timingValue).build());

This will give you a report in the App Speed section of the Behavior section in the reporting tab.

However, another problem arose regarding custom reporting of timed events which is described here: GoogleAnalytics HitBuilders.TimingBuilder

like image 101
Yonatan Nir Avatar answered Oct 22 '22 02:10

Yonatan Nir