Skip to content

Commit 9b3f864

Browse files
authored
Merge pull request segment-integrations#6 from segment-integrations/fix/truncate-excess-paramaters
remove excess parameters in track and screen
2 parents 51c8d97 + 19806a2 commit 9b3f864

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

Pod/Classes/SEGFlurryIntegration.m

+21-2
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,19 @@ - (void)identify:(SEGIdentifyPayload *)payload
5858

5959
- (void)track:(SEGTrackPayload *)payload
6060
{
61-
[Flurry logEvent:payload.event withParameters:payload.properties];
61+
NSMutableDictionary *properties = [self truncateProperties:payload.properties];
62+
63+
[Flurry logEvent:payload.event withParameters:properties];
64+
SEGLog(@"Flurry logEvent:%@ withParameters:%@", payload.event, properties);
6265
}
6366

6467
- (void)screen:(SEGScreenPayload *)payload
6568
{
6669
if ([self screenTracksEvents]) {
6770
NSString *event = [[NSString alloc] initWithFormat:@"Viewed %@ Screen", payload.name];
68-
[Flurry logEvent:event withParameters:payload.properties];
71+
NSMutableDictionary *properties = [self truncateProperties:payload.properties];
72+
[Flurry logEvent:event withParameters:properties];
73+
SEGLog(@"Flurry logEvent:%@ withParameters:%@", event, properties);
6974
}
7075

7176
// Flurry just counts the number of page views
@@ -80,4 +85,18 @@ - (BOOL)screenTracksEvents
8085
return [(NSNumber *)[self.settings objectForKey:@"screenTracksEvents"] boolValue];
8186
}
8287

88+
// Returns NSDictionary truncated to 10 entries
89+
90+
-(NSMutableDictionary *)truncateProperties:(NSDictionary *) properties
91+
{
92+
NSMutableDictionary *truncatedProperties;
93+
for (NSString *property in properties) {
94+
truncatedProperties[property] = properties[property];
95+
if ([truncatedProperties count] == 10) {
96+
break;
97+
}
98+
}
99+
return truncatedProperties;
100+
}
101+
83102
@end

0 commit comments

Comments
 (0)