Skip to content

Commit

Permalink
Merge pull request #354 from Countly/visibility-prev-names-segmentaio…
Browse files Browse the repository at this point in the history
…n-fix

Fixed visibility and previous name segmentation if no segmentation is provided
  • Loading branch information
turtledreams authored Nov 4, 2024
2 parents 3fc07ab + 93a5dcd commit 28e15bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## xx.xx.xx
* Mitigated an issue with experimental visibility tracking and previous name recording, ensuring they’re included even when no segmentation is provided in event or view recording.

## 24.7.5
* Mitigated an issue with content action json parsing due to json encoding
* Mitigated an issue where pausing a view resulted in a '0' view duration.
Expand Down
5 changes: 4 additions & 1 deletion Countly.m
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,8 @@ - (void)recordEvent:(NSString *)key segmentation:(NSDictionary *)segmentation co
BOOL isReservedEvent = [self isReservedEvent:key];

NSMutableDictionary *filteredSegmentations = segmentation.cly_filterSupportedDataTypes;
if(filteredSegmentations == nil)
filteredSegmentations = NSMutableDictionary.new;

// If the event is not reserved, assign the previous event ID and Name to the current event's PEID property, or an empty string if previousEventID is nil. Then, update previousEventID to the current event's ID.
if (!isReservedEvent)
Expand Down Expand Up @@ -941,7 +943,8 @@ - (NSDictionary*) processSegmentation:(NSMutableDictionary *) segmentation event
if(CountlyCommon.sharedInstance.enableVisibiltyTracking) {
segmentation[kCountlyVisibility] = @([self isAppInForeground]);
}
return segmentation;

return segmentation.count == 0 ? nil : segmentation;
}

- (BOOL)isAppInForeground {
Expand Down

0 comments on commit 28e15bd

Please sign in to comment.