Class: OursprivacyIngest::Resources::Experiments
- Inherits:
-
Object
- Object
- OursprivacyIngest::Resources::Experiments
- Defined in:
- lib/oursprivacy_ingest/resources/experiments.rb
Instance Method Summary collapse
-
#assignment(experiment_key, token:, visitor_id:, context: nil, track_impression: nil, request_options: {}) ⇒ OursprivacyIngest::Models::ExperimentAssignmentResponse::UnionMember0, OursprivacyIngest::Models::ExperimentAssignmentResponse::UnionMember1
Some parameter documentations has been truncated, see Models::ExperimentAssignmentParams for more details.
-
#initialize(client:) ⇒ Experiments
constructor
private
A new instance of Experiments.
-
#personalization(token:, visitor_id:, request_options: {}) ⇒ OursprivacyIngest::Models::ExperimentPersonalizationResponse
Return the active personalization assignments for a visitor.
Constructor Details
#initialize(client:) ⇒ Experiments
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Experiments.
86 87 88 |
# File 'lib/oursprivacy_ingest/resources/experiments.rb', line 86 def initialize(client:) @client = client end |
Instance Method Details
#assignment(experiment_key, token:, visitor_id:, context: nil, track_impression: nil, request_options: {}) ⇒ OursprivacyIngest::Models::ExperimentAssignmentResponse::UnionMember0, OursprivacyIngest::Models::ExperimentAssignmentResponse::UnionMember1
Some parameter documentations has been truncated, see Models::ExperimentAssignmentParams for more details.
Return the server-side variant assignment for a visitor in a single A/B or multivariate experiment, identified by its experiment key. Bucketing is deterministic on ‘visitor_id` and is sticky across calls. Tracking an impression is the default — pass `track_impression: false` to read without recording. The browser SDK and this endpoint converge on the same variant for the same visitor.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/oursprivacy_ingest/resources/experiments.rb', line 32 def assignment(experiment_key, params) parsed, = OursprivacyIngest::ExperimentAssignmentParams.dump_request(params) path = if @client.base_url_overridden? [ "experiments/assignments/%1$s", experiment_key ] else [ "https://api.oursprivacy.com/api/v1/experiments/assignments/%1$s", experiment_key ] end @client.request( method: :post, path: path, body: parsed, model: OursprivacyIngest::Models::ExperimentAssignmentResponse, options: ) end |
#personalization(token:, visitor_id:, request_options: {}) ⇒ OursprivacyIngest::Models::ExperimentPersonalizationResponse
Return the active personalization assignments for a visitor. Read-only and never records an impression. Personalizations are populated by the event-driven rule engine — until that ships, this endpoint returns an empty list for every visitor, which is the correct fail-closed behavior (no false positives).
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/oursprivacy_ingest/resources/experiments.rb', line 70 def personalization(params) parsed, = OursprivacyIngest::ExperimentPersonalizationParams.dump_request(params) path = @client.base_url_overridden? ? "experiments/personalization" : "https://api.oursprivacy.com/api/v1/experiments/personalization" @client.request( method: :post, path: path, body: parsed, model: OursprivacyIngest::Models::ExperimentPersonalizationResponse, options: ) end |