ConfusedNoob
ConfusedNoob

Reputation: 10186

How to use Google's User Timing feature in iOS analytics SDK

I'm using Google Analytics in my iOS application and I'm trying to use their user timing feature, to record how responsive my backend HTTP server is. Code shown below:

NSTimeInterval interval = [date timeIntervalSinceNow];
[self.tracker trackTimingWithCategory:@"request"
                            withValue:interval
                             withName:request.URL.absoluteString
                            withLabel:nil];

However, nothing is being shown in the reports in Google Analytics, any idea? How can I debug this?

Upvotes: 0

Views: 579

Answers (1)

Avi
Avi

Reputation: 2383

I think one of the issues you are encountering here is the negative value for second parameter. May be try something like this:

NSTimeInterval interval = -[date timeIntervalSinceNow];
[self.tracker trackTimingWithCategory:@"request"
                            withValue:interval
                             withName:request.URL.absoluteString
                            withLabel:nil];

Notice the extra "-" in the first line.

An alternative could be to use one of the other tracking mechanisms like events/custom variables or metrics.

Upvotes: 1

Related Questions