Class: Optimizely::EventBuilderV2
- Inherits:
-
BaseEventBuilder
- Object
- BaseEventBuilder
- Optimizely::EventBuilderV2
- Defined in:
- lib/optimizely/event_builder.rb
Constant Summary collapse
- CONVERSION_EVENT_ENDPOINT =
'https://logx.optimizely.com/log/event'- IMPRESSION_EVENT_ENDPOINT =
'https://logx.optimizely.com/log/decision'- POST_HEADERS =
{ 'Content-Type' => 'application/json' }
Instance Attribute Summary
Attributes inherited from BaseEventBuilder
Instance Method Summary collapse
- #create_conversion_event(event_key, user_id, attributes, event_tags, experiment_variation_map) ⇒ Object
- #create_impression_event(experiment_key, variation_id, user_id, attributes) ⇒ Object
Methods inherited from BaseEventBuilder
Constructor Details
This class inherits a constructor from Optimizely::BaseEventBuilder
Instance Method Details
#create_conversion_event(event_key, user_id, attributes, event_tags, experiment_variation_map) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/optimizely/event_builder.rb', line 91 def create_conversion_event(event_key, user_id, attributes, , experiment_variation_map) # Create conversion Event to be sent to the logging endpoint. # # event_key - Event key representing the event which needs to be recorded. # user_id - ID for user. # attributes - Hash representing user attributes and values which need to be recorded. # event_tags - Hash representing metadata associated with the event. # experiment_variation_map - Map of experiment ID to the ID of the variation that the user is bucketed into. # # Returns event hash encapsulating the conversion event. @params = {} add_common_params(user_id, attributes) add_conversion_event(event_key) () add_layer_states(experiment_variation_map) Event.new(:post, CONVERSION_EVENT_ENDPOINT, @params, POST_HEADERS) end |
#create_impression_event(experiment_key, variation_id, user_id, attributes) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/optimizely/event_builder.rb', line 74 def create_impression_event(experiment_key, variation_id, user_id, attributes) # Create conversion Event to be sent to the logging endpoint. # # experiment_key - Experiment for which impression needs to be recorded. # variation_id - ID for variation which would be presented to user. # user_id - ID for user. # attributes - Hash representing user attributes and values which need to be recorded. # # Returns event hash encapsulating the impression event. @params = {} add_common_params(user_id, attributes) add_decision(experiment_key, variation_id) add_attributes(attributes) Event.new(:post, IMPRESSION_EVENT_ENDPOINT, @params, POST_HEADERS) end |