Skip to content

Feature - IP Anonymization #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/optimizely/event_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ def get_common_params(user_id, attributes)
snapshots: [],
visitor_id: user_id
}
],
revision: @config.revision,
client_name: CLIENT_ENGINE,
client_version: VERSION
],
anonymize_ip: @config.anonymize_ip,
revision: @config.revision,
client_name: CLIENT_ENGINE,
client_version: VERSION
}

common_params
Expand Down
3 changes: 3 additions & 0 deletions lib/optimizely/project_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class ProjectConfig
attr_reader :groups
attr_reader :parsing_succeeded
attr_reader :project_id
# Boolean - denotes if Optimizely should remove the last block of visitors' IP address before storing event data
attr_reader :anonymize_ip
attr_reader :revision
attr_reader :rollouts
attr_reader :version
Expand Down Expand Up @@ -86,6 +88,7 @@ def initialize(datafile, logger, error_handler)
@feature_flags = config.fetch('featureFlags', [])
@groups = config.fetch('groups', [])
@project_id = config['projectId']
@anonymize_ip = (config.has_key? 'anonymizeIP')? config['anonymizeIP'] :false
@revision = config['revision']
@rollouts = config.fetch('rollouts', [])

Expand Down
2 changes: 2 additions & 0 deletions spec/event_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
}]
}]
}],
anonymize_ip: false,
revision: '42',
client_name: Optimizely::CLIENT_ENGINE,
client_version: Optimizely::VERSION
Expand All @@ -81,6 +82,7 @@
}]
}]
}],
anonymize_ip: false,
revision: '42',
client_name: Optimizely::CLIENT_ENGINE,
client_version: Optimizely::VERSION
Expand Down
3 changes: 3 additions & 0 deletions spec/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class InvalidErrorHandler; end
}],
visitor_id: 'test_user'
}],
anonymize_ip: false,
revision: '42',
client_name: Optimizely::CLIENT_ENGINE,
client_version: Optimizely::VERSION
Expand Down Expand Up @@ -345,6 +346,7 @@ class InvalidErrorHandler; end
}],
visitor_id: 'test_user'
}],
anonymize_ip: false,
revision: '42',
client_name: Optimizely::CLIENT_ENGINE,
client_version: Optimizely::VERSION
Expand Down Expand Up @@ -599,6 +601,7 @@ class InvalidErrorHandler; end
}],
visitor_id: 'test_user'
}],
anonymize_ip: false,
revision: '42',
client_name: Optimizely::CLIENT_ENGINE,
client_version: Optimizely::VERSION
Expand Down
1 change: 1 addition & 0 deletions spec/spec_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module OptimizelySpec
VALID_CONFIG_BODY = {
'accountId' => '12001',
'projectId' => '111001',
'anonymizeIP'=> false,
'revision' => '42',
'version' => '2',
'events' => [{
Expand Down