Skip to content

Commit caca619

Browse files
committed
fix segment hit
1 parent 3d766f5 commit caca619

File tree

6 files changed

+24
-10
lines changed

6 files changed

+24
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11

2+
# 4.2.1-beta - 20/11/2025
3+
4+
- Converts all persona values to strings in segment tracking.
25

36
# 4.2.0-beta - 4/11/2025
47

example/lib/Providers/fs_data.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ class UserData extends ChangeNotifier {
7070
"testing_tracking_manager": true,
7171
"isQA": true,
7272
"fs_is_vip": true,
73-
"condition1": "spécial"
73+
"customer": "spécial",
74+
"condition1": "segment",
75+
"bucketKeyFlutter": "Mercredi",
76+
"numericKeyFlutter": true,
77+
"floatKeyFlutter": 12.5,
78+
"nullKeyFlutter": Null
7479
};
7580
bool _hasConsented = true;
7681
bool _isAuthenticated = false;

lib/flagship_version.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/// This file is automatically updated
2-
const FlagshipVersion = "4.2.0-beta";
2+
const FlagshipVersion = "4.2.1-beta";

lib/hits/segment.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ class Segment extends BaseHit {
1010
@override
1111
Map<String, Object> get bodyTrack {
1212
var customBody = new Map<String, Object>();
13-
customBody.addAll({"s": persona, "t": typeOfEvent});
14-
// Add commun body
13+
// Convert persona values to String
14+
Map<String, String> personaString =
15+
persona.map((key, value) => MapEntry(key, value.toString()));
16+
customBody.addAll({"s": personaString, "t": typeOfEvent});
17+
// Add common body
1518
customBody.addAll(super.communBodyTrack);
1619
return customBody;
1720
}

lib/visitor/strategy/default_strategy.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ class DefaultStrategy implements IVisitor {
7272
Flagship.logger(Level.INFO, " The campaign's flag already activated ");
7373
return;
7474
}
75-
7675
// When not duplicated
77-
final String? flagJson =
78-
exposedFlag != null ? jsonEncode(exposedFlag) : null;
79-
final String? visitorJson =
80-
exposedVisitor != null ? jsonEncode(exposedVisitor) : null;
76+
String? flagJson = null;
77+
String? visitorJson = null;
78+
try {
79+
exposedFlag != null ? jsonEncode(exposedFlag) : null;
80+
exposedVisitor != null ? jsonEncode(exposedVisitor) : null;
81+
} catch (e) {
82+
Flagship.logger(Level.ERROR, "Error encoding exposure data: $e");
83+
}
8184

8285
final activateHit = Activate(
8386
modification,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flagship
22
description: Flutter SDK for Flagship Feature management & Experiment platform for modern engineering and product teams
3-
version: 4.2.0-beta
3+
version: 4.2.1-beta
44
homepage: https://flagship.io
55

66
environment:

0 commit comments

Comments
 (0)