Skip to content

Commit 1015e2f

Browse files
committed
Merge branch 'master' into rev_bucketing_id
# Conflicts: # lib/optimizely/event_builder.rb
2 parents f0e9654 + a1e6b6f commit 1015e2f

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

lib/optimizely/event_builder.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,16 @@ def get_common_params(user_id, attributes)
9999
end
100100

101101
common_params = {
102-
account_id: @config.account_id,
103-
project_id: @config.project_id,
104-
visitors: [
105-
{
106-
attributes: visitor_attributes,
107-
snapshots: [],
108-
visitor_id: user_id
109-
}
102+
account_id: @config.account_id,
103+
project_id: @config.project_id,
104+
visitors: [
105+
{
106+
attributes: visitor_attributes,
107+
snapshots: [],
108+
visitor_id: user_id
109+
}
110110
],
111+
anonymize_ip: @config.anonymize_ip,
111112
revision: @config.revision,
112113
client_name: CLIENT_ENGINE,
113114
client_version: VERSION

lib/optimizely/project_config.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class ProjectConfig
3838
attr_reader :groups
3939
attr_reader :parsing_succeeded
4040
attr_reader :project_id
41+
# Boolean - denotes if Optimizely should remove the last block of visitors' IP address before storing event data
42+
attr_reader :anonymize_ip
4143
attr_reader :revision
4244
attr_reader :rollouts
4345
attr_reader :version
@@ -86,6 +88,7 @@ def initialize(datafile, logger, error_handler)
8688
@feature_flags = config.fetch('featureFlags', [])
8789
@groups = config.fetch('groups', [])
8890
@project_id = config['projectId']
91+
@anonymize_ip = (config.has_key? 'anonymizeIP')? config['anonymizeIP'] :false
8992
@revision = config['revision']
9093
@rollouts = config.fetch('rollouts', [])
9194

spec/event_builder_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
}]
5858
}]
5959
}],
60+
anonymize_ip: false,
6061
revision: '42',
6162
client_name: Optimizely::CLIENT_ENGINE,
6263
client_version: Optimizely::VERSION
@@ -81,6 +82,7 @@
8182
}]
8283
}]
8384
}],
85+
anonymize_ip: false,
8486
revision: '42',
8587
client_name: Optimizely::CLIENT_ENGINE,
8688
client_version: Optimizely::VERSION

spec/project_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class InvalidErrorHandler; end
142142
}],
143143
visitor_id: 'test_user'
144144
}],
145+
anonymize_ip: false,
145146
revision: '42',
146147
client_name: Optimizely::CLIENT_ENGINE,
147148
client_version: Optimizely::VERSION
@@ -345,6 +346,7 @@ class InvalidErrorHandler; end
345346
}],
346347
visitor_id: 'test_user'
347348
}],
349+
anonymize_ip: false,
348350
revision: '42',
349351
client_name: Optimizely::CLIENT_ENGINE,
350352
client_version: Optimizely::VERSION
@@ -628,6 +630,7 @@ class InvalidErrorHandler; end
628630
}],
629631
visitor_id: 'test_user'
630632
}],
633+
anonymize_ip: false,
631634
revision: '42',
632635
client_name: Optimizely::CLIENT_ENGINE,
633636
client_version: Optimizely::VERSION

spec/spec_params.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module OptimizelySpec
2121
VALID_CONFIG_BODY = {
2222
'accountId' => '12001',
2323
'projectId' => '111001',
24+
'anonymizeIP'=> false,
2425
'revision' => '42',
2526
'version' => '2',
2627
'events' => [{

0 commit comments

Comments
 (0)