sendUserEvents

Version 2024-11-01

📘

Important

The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.

Overview

Send user events to analytics by providing SendEventInput.

Response

Return type SendUserEventOutput

Arguments

ArgumentDescription
input (SendUserEventInput required)

Examples


Complete Send User Events Mutation

Request

mutation sendEvents {
    sendUserEvents(input : {
        events:[
            {
                eventType: "page-load",
                eventId: "11c7e59a-d462-4254-bc7e-3e44528ef6d0",
                eventTime: "2023-12-03T10:15:30Z"
                clientType: WEBSITE_CLIENT,
                clientVersion: "1.0",
                additionalProperties: {
                    additionalProperties: [
                        {
                            property: "current_url",
                            value: "https://example.com"
                        }
                    ]
                }
            }
        ]
    }
    ) {
        status
    }
}

Response

{
  "data": {
    "sendUserEvents": {
      "status": "successful"
    }
  }
}

Send User Events Validation Exception

Request

mutation sendEvents {
    sendUserEvents(input : {
        events:[
            {
                eventType: "page-load",
                eventId: "11c7e59a-d462-4254-bc7e-3e44528ef6d0",
                eventTime: "2023",
                clientType: WEBSITE_CLIENT,
                clientVersion: "1.0",
            }
        ]
    }
    ) {
        status
    }
}

Response

{
  "errors": [
    {
      "message": "Input request is not valid, the following issues were encountered: [eventTime 2023 is invalid local ISO 8601 UTC time format.]",
      "locations": [
        {
          "line": 2,
          "column": 68
        }
      ],
      "path": [
        "sendUserEvents"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "UnspecifiedError",
          "details": {},
          "errorType": "ValidationException",
          "errorCode": 400
        }
      }
    }
  ],
  "data": {
    "sendUserEvents": null
  }
}