Bundle events and visitors

The examples below include the optional client_name and client_version fields. We recommend that you include these fields for debugging purposes. For a complete description of the Event API, consult the Event API reference.

πŸ“˜

Note

A single JSON object must be 3.5 MB or less.

Bundle more events

This example shows that a visitor has been exposed to another variation and performs another tracked action on the site.

πŸ“˜

Note

The order of the events in the events array is not important.

{
  "account_id": "1887578053",
  "project_id": "7205579439",
  "visitors": [
    {
      "session_id": "",
      "visitor_id": "test_user",
      "snapshots": [
        {
          "decisions": [],
          "events": [
            {
              "key": "4841578001_view_optimizely_dev_docs",
              "entity_id": "4841578001",
              "revenue": 100,
              "timestamp": 1491519130344,
              "uuid": "145a44a2-6320-48d6-80d6-bff20b32cd65"
            },
            {
              "key": "8766076075_click_view_docs",
              "entity_id": "8766076075",
              "revenue": 400,
              "timestamp": 1491519130352,
              "uuid": "3bb9371d-c245-4bf8-8086-5fef9f60cd06"
            }
          ]
        }
      ]
    }
  ],
  "anonymize_ip": true,
  "client_name": "Optimizely/event-api-demo",
  "client_version": "1.0.0",
  "enrich_decisions": true
}

Bundle more visitors

This example shows that a second visitor has been exposed to a different variation of the same campaign and experiment as the first visitor. The second visitor performs one of the same tracked actions as the first visitor.

{
  "account_id": "1887578053",
  "project_id": "7205579439",
  "visitors": [
    {
      "session_id": "",
      "visitor_id": "test_user",
      "snapshots": [
          {
          "decisions": [],
          "events": [
            {
              "key": "4841578001_view_optimizely_dev_docs",
              "entity_id": "4841578001",
              "revenue": 100,
              "timestamp": 1491519130344,
              "uuid": "145a44a2-6320-48d6-80d6-bff20b32cd65"
            },
            {
              "key": "8766076075_click_view_docs",
              "entity_id": "8766076075",
              "revenue": 400,
              "timestamp": 1491519130352,
              "uuid": "3bb9371d-c245-4bf8-8086-5fef9f60cd06"
            }
          ]
        }
      ]
    },
    {
      "session_id": "",
      "visitor_id": "another_test_user",
      "snapshots": [
        {
          "decisions": [],
          "events": [
            {
              "key": "4841578001_view_optimizely_dev_docs",
              "entity_id": "4841578001",
              "revenue": 400,
              "timestamp": 1491519130362,
              "uuid": "899de30f-fa1b-440c-b8a8-75a18da104a2"
            }
          ]
        }
      ]
    }
  ],
  "anonymize_ip": true,
  "client_name": "Optimizely/event-api-demo",
  "client_version": "1.0.0",
  "enrich_decisions": true
}
{
  "account_id": "1887578053",
  "project_id": "7205579439",
  "visitors": [
    {
      "session_id": "",
      "visitor_id": "test_user",
      "snapshots": [
          {
          "decisions": [],
          "events": [
            {
              "key": "4841578001_view_optimizely_dev_docs",
              "entity_id": "4841578001",
              "revenue": 100,
              "timestamp": 1491519130344,
              "uuid": "145a44a2-6320-48d6-80d6-bff20b32cd65"
            },
            {
              "key": "8766076075_click_view_docs",
              "entity_id": "8766076075",
              "revenue": 400,
              "timestamp": 1491519130352,
              "uuid": "3bb9371d-c245-4bf8-8086-5fef9f60cd06"
            }
          ]
        }
      ]
    },
    {
      "session_id": "",
      "visitor_id": "another_test_user",
      "snapshots": [
        {
          "decisions": [],
          "events": [
            {
              "key": "4841578001_view_optimizely_dev_docs",
              "entity_id": "4841578001",
              "revenue": 400,
              "timestamp": 1491519130362,
              "uuid": "899de30f-fa1b-440c-b8a8-75a18da104a2"
            }
          ]
        }
      ]
    }
  ],
  "anonymize_ip": true,
  "client_name": "Optimizely/event-api-demo",
  "client_version": "1.0.0",
  "enrich_decisions": true
}