Skip to content

Commit

Permalink
fix(VWO.m): update setCustomVariable API to set the correct variables
Browse files Browse the repository at this point in the history
  • Loading branch information
NAKULT authored and Varun Malhotra committed Jun 15, 2022
1 parent 961e32b commit 859a854
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion VWO/VWO.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

static VWOLogLevel kLogLevel = VWOLogLevelError;
static BOOL kOptOut = NO;
NSMutableDictionary<NSString *, NSString *> *customVariables;

NSString * const VWOUserStartedTrackingInCampaignNotification = @"VWOUserStartedTrackingInCampaignNotification";

Expand Down Expand Up @@ -176,10 +177,15 @@ + (void)trackConversion:(NSString *)goal withValue:(double)value {
+ (void)setCustomVariable:(NSString *)key withValue:(NSString *)value {
NSParameterAssert(key);
NSParameterAssert(value);
if (customVariables == nil) {
customVariables = [NSMutableDictionary new];
}
customVariables[key] = value;
dispatch_barrier_async(VWOController.taskQueue, ^{
VWOController.shared.customVariables[key] = value;
VWOController.shared.customVariables = customVariables;
});
}


+ (void)pushCustomDimension:(NSString *)customDimensionKey withCustomDimensionValue:(nonnull NSString *)customDimensionValue {
NSParameterAssert(customDimensionKey);
Expand Down

0 comments on commit 859a854

Please sign in to comment.