openapi: 3.2.0 info: version: 1.3.0 title: Optimizely Event API Reference API description: 'The Event API allows developers to send impression or event data to Optimizely from anywhere. Our JavaScript API, mobile SDKs and Fullstack SDKs include out-of-the-box tracking for impressions and events on your site or application, but you might want to send conversion data that occurs offline or with your own client. In cases like these, event calls may be sent directly to Optimizely''s logging servers via this API. ```' servers: - name: Primary Ingestion Endpoint url: https://logx.optimizely.com/v1 description: The primary endpoint for logging events to Optimizely. US-based data residency. - name: EU-Hosted Ingestion Endpoint url: https://eu.logx.optimizely.com/v1 description: The secondary endpoint for logging events to Optimizely. EU-based data residency. Should only be used by approved customers. tags: - name: API Reference description: Log Endpoint paths: /events: post: summary: Log Endpoint tags: - API Reference parameters: - name: X-Optimizely-Strict in: header description: Optionally return failure statuses when the request body doesn't meet all field constraints. Default behavior is to be as permissive as possible and silently reject unusable requests. required: false schema: type: boolean default: false requestBody: content: application/json: schema: $ref: '#/components/schemas/EventBatch' description: JSON object that holds an array of visitor objects that describe the visitor\'s experience during an Optimizely campaign. required: true responses: '204': description: The events were queued for recording by the Optimizely backend. '400': description: The request is malformed or otherwise failed validation by the Optimizely backend. '500': description: A server error occurred. The client should attempt to resend the events at a later time. components: schemas: Tags: type: object description: Arbitrary key value pairs attached to an event. The value can be a string, integer, number, or booean. A non-string type can also be sent as a string value prefixed by the unicode character U+E000. For example the integer 123 can be sent as "\UE000123". example: video_title: Funny Cats duration: 22 Visitor: type: object required: - visitor_id - snapshots properties: session_id: description: A unique identifier that identifies the session context, if any, for these events. If omitted, the Optimizely backend will calculate session-based results by inferring sessions by opening a session when an event is first received from a given visitor_id, and closing the session after 30 minutes with no events received for that visitor, with a maximum session size of 24 hours. type: string example: session_1231982382 visitor_id: description: A unique identifier for the visitor type: string example: user_32912378471284 attributes: description: Attributes associated with this visitor at the time of this request type: array items: $ref: '#/components/schemas/Attribute' snapshots: description: An array of events triggered for an experiment, and the decision snapshot when that event occurred. Events can occur within different decision snapshots. Events occurring in different snapshots should be contained in different snapshot items. type: array items: $ref: '#/components/schemas/Snapshot' Snapshot: type: object required: - events properties: decisions: description: The list of bucketing Decisions made for the visitor (i.e. which experiments and variations the visitor was exposed to) for the duration of the session thus far. If the `enrich_decisions` option is enabled, just the Decisions associated to `campaign_activated` event in same Snapshot are necessary. type: array items: $ref: '#/components/schemas/Decision' externalDocs: description: enrich_decisions option url: https://developers.optimizely.com/x/events/api/index.html#EventBatch_ events: description: The list of Events that should be recorded by the Optimizely backend within the given visitor, session and account context. type: array items: $ref: '#/components/schemas/Event' Event: type: object required: - timestamp - uuid properties: timestamp: description: Timestamp at which the event was generated, time since the epoch in milliseconds. type: integer example: 1485989442742316000 uuid: description: A unique identifier for this Event. This may be generated by the client with a typical UUID-generating method. Used by Optimizely's backend to de-duplicate requests that are accidentally or erroneously replayed. type: string example: 0255F96D-922B-433B-B474-5D87EC1AB122 key: description: The event key (aka API name) for this event. type: string example: my_event_name type: description: the type of event. For example, to indicate a 'decision_point' type should be 'campaign_activated'. type: string example: campaign_activated value: description: A scalar value associated with an event. This should be some non-revenue number. type: number example: 1.234 quantity: description: An aggregatable "count" associated with this event; for example, a number of video views or items in a shopping cart. type: integer example: 4 revenue: description: An aggregatable revenue amount associated with this event, in 1/100th of an arbitrary currency unit. For example, to represent $23.42, this field would be set to 2342. type: integer format: int64 example: 2342 tags: $ref: '#/components/schemas/Tags' entity_id: description: The id of the entity corresponding to this event. type: string example: '1234' properties: description: Key value pairs defining properties or characteristics of the event. The value must be a string. type: object Decision: description: This object represents a decision that was made to bucket a visitor into a particular experiment and variation. type: object required: - experiment_id - variation_id - campaign_id properties: experiment_id: type: string description: The id of the experiment the visitor was exposed to. For Personalization Campaigns, clients should explicitly send null as the experiment_id for visitors not bucketed into any Experiment, for the purpose of accurately computing Campaign reach. example: '1234' variation_id: type: string description: The id of the variation the visitor was exposed to. For Personalization Campaigns, clients should explicitly send null as the variation_id for visitors not bucketed into any Experiment, for the purpose of accurately computing Campaign reach. example: '5678' campaign_id: type: string description: The id of the campaign containing this experiment. example: '4321' is_campaign_holdback: type: boolean description: If true, the chosen experience was held back at the campaign level. Required for Personalization, omit otherwise. example: false Attribute: description: An Attribute describes some feature or characteristic of the visitor. type: object required: - type - value properties: type: description: Describes what kind of Attribute this is (i.e., "custom", "location", etc.) type: string example: custom entity_id: description: The ID of the entity corresponding to this Attribute. This is only required for custom attributes (type="custom"), and invalid for other Attribute types. type: string example: '1234' key: description: The key (or API name) of the this Attribute. This is only required for custom attributes (type="custom"), and optional for other Attribute types. type: string example: shoe_purchased value: description: The value can be an arbitrary string, integer, number, or a boolean. A boolean, integer or number can also be sent as a string value prefixed by the unicode character U+E000 . For example the integer 123 can be sent as "\UE000123". example: nike zoom air EventBatch: type: object required: - account_id - visitors properties: account_id: description: The Optimizely account to which these events should be attributed. type: string example: '1234' project_id: description: The project_id needs only to be passed if you are using the Recommendations product. type: string example: '5678' anonymize_ip: description: Optimizely typically stores the client IP address for each request. If this flag is true, the last octet of the IP will be truncated before it is stored. If false, the entire IP address will be stored. This is most relevant for consumers of this API that are implemented in a web browser or mobile client context who are subject to policies or regulation restricting the storage of end-user identifying information. Note that this flag is independent of the IP anonymization setting in the Account and Project settings, which only controls how Optimizely clients set this flag. Also note that if this flag is set, care must be taken when using the IP filtering feature, as fully-qualified explicit IP addresses will not function as filters (anonymization occurs before events are filtered by IP). type: boolean default: true client_name: description: A unique identifier for the system that generated this event. By convention, this should be something like "organization_name/system_name". type: string example: acmecorp/offlineconversiontracker client_version: description: A version identifier for the system that generated this event. type: string example: 1.0.0 visitors: description: An array of visitor objects that describe the visitor\'s experience during an Optimizely campaign. type: array items: $ref: '#/components/schemas/Visitor' x-readme: explorer-enabled: true proxy-enabled: true