clauswey
clauswey

Reputation: 1741

Why is the event value not shown in Google Analytics when using the iOS SDK?

In my iOS App(SDK 8.2) the event value I send to Google Analytics is never tracked and will always be shown as 0

[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"categoryX" 
     action:@"actionY" 
     label:@"labelZ" 
     value:@(1.5)] build]];

Upvotes: 3

Views: 827

Answers (1)

clauswey
clauswey

Reputation: 1741

The problem is the floating point value. Values can only be integer but must be passed as NSNumber. The following turned out to work quite well:

NSNumber* myValue = 1.5;
myValue = @(round([myValue doubleValue]));
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"categoryX" 
     action:@"actionY" 
     label:@"labelZ" 
     value:myValue] build]];

Of course this will round what ever value you want to track, so you'll need to choose you measurement unit with care. (e.g. track milliseconds instead of seconds)

Upvotes: 3

Related Questions