서버 측 이벤트 전송
https://browser-intake-datadoghq.com/api/v2/prodlyticshttps://browser-intake-us3-datadoghq.com/api/v2/prodlyticshttps://browser-intake-us5-datadoghq.com/api/v2/prodlyticshttps://browser-intake-datadoghq.eu/api/v2/prodlyticshttps://browser-intake-ap1-datadoghq.com/api/v2/prodlyticshttps://browser-intake-ap2-datadoghq.com/api/v2/prodlyticshttps://browser-intake-uk1-datadoghq.com/api/v2/prodlyticsNot supported in the US1-FED regionNot supported in the US2-FED region개요
서버 측 이벤트를 Product Analytics로 보냅니다. 서버 측 이벤트는 15개월 동안 보관됩니다.
Product Analytics의 서버 측 이벤트는 서버에서 발생하는 이벤트를 추적하는 데 유용하며,
Real User Monitoring(RUM) SDK로 캡처되는 클라이언트 측 이벤트와는 대조적입니다.
이를 통해 서버에서 발생하는 작업을 포함하여 사용자 여정을 보다 포괄적으로 파악할 수 있습니다.
일반적인 예로는 checkout.completed 또는 payment.processed가 있습니다.
수집된 서버 측 이벤트는 Product Analytics에 통합되어 사용자가 이벤트를 선택하고 필터링할 수 있도록 하며, 뷰나 작업이 처리되는 방식과 유사하게 이벤트 선택기에서 이러한 이벤트를 처리할 수 있습니다.
요구 사항:
usr,account또는session중 하나 이상은 유효한 ID와 함께 제공되어야 합니다.application.id는 Product Analytics가 활성화된 애플리케이션을 참조해야 합니다.
사용자 지정 속성:
페이로드의 추가 필드는 평면화되어 패싯으로 검색할 수 있습니다.
예를 들어, {"customer": {"tier": "premium"}} 페이로드는 Datadog에서 @customer.tier:premium
구문을 사용하여 검색할 수 있습니다.
HTTP API가 응답하는 상태 코드는 다음과 같습니다.
- 202: 수락됨: 요청이 처리를 위해 수락되었습니다.
- 400: 잘못된 요청(페이로드 형식 문제일 가능성이 높음)
- 401: 승인되지 않음(API 키가 누락되었을 가능성이 높음)
- 403: 권한 문제(유효하지 않은 API 키를 사용 중일 가능성이 높음)
- 408: 요청 시간 초과, 일정 시간 후 요청을 재시도해야 합니다.
- 413: 페이로드가 너무 큼(배치가 압축 해제 상태에서 5MB를 초과함)
- 429: 요청이 너무 많음, 일정 시간 후 요청을 재시도해야 합니다.
- 500: 내부 서버 오류, 서버가 요청을 이행하지 못하게 하는 예기치 않은 상태가 발생했으며, 일정 시간 후 요청을 재시도해야 합니다.
- 503: 서비스 이용 불가, 서버가 과부하 상태여서 요청을 처리할 준비가 되지 않았을 수 있으므로 잠시 후 요청을 다시 시도해야 합니다.
요청
Body Data (required)
전송할 서버 측 이벤트(JSON 형식)입니다.
accountProduct Analytics 서버 측 이벤트입니다.
id [required]The account ID used in Datadog.
application [required]The application in which you want to send your events.
id [required]The application ID of your application. It can be found in your application management page.
event [required]Fields used for the event.
name [required]The name of your event, which is used for search in the same way as view or action names.
sessionThe session linked to your event.
id [required]The session ID captured by the SDK.
type [required]The type of Product Analytics event. Must be server for server-side events.
serverusrThe user linked to your event.
id [required]The user ID used in Datadog.
{
"account": {
"id": "account-67890"
},
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"session": {
"id": "session-abcdef"
},
"type": "server",
"usr": {
"id": "user-12345"
}
}응답
Request accepted for processing (always 202 empty JSON).
No response body
{}Bad Request
Error response.
errorsStructured errors.
detailError message.
statusError code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}Unauthorized
Error response.
errorsStructured errors.
detailError message.
statusError code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}Forbidden
Error response.
errorsStructured errors.
detailError message.
statusError code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}Request Timeout
Error response.
errorsStructured errors.
detailError message.
statusError code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}Payload Too Large
Error response.
errorsStructured errors.
detailError message.
statusError code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}Too Many Requests
Error response.
errorsStructured errors.
detailError message.
statusError code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}Internal Server Error
Error response.
errorsStructured errors.
detailError message.
statusError code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}Service Unavailable
Error response.
errorsStructured errors.
detailError message.
statusError code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}코드 예시
## default
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with account ID
# Send a server-side event linked to an account.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"account": {
"id": "account-456"
},
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "checkout.completed"
},
"type": "server"
}
EOF
## Event with custom attributes
# Send a server-side event with additional custom attributes.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"customer": {
"tier": "premium"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with session ID
# Send a server-side event linked to a session.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "form.submitted"
},
"session": {
"id": "session-789"
},
"type": "server"
}
EOF
## Simple event with user ID
# Send a server-side event linked to a user.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF## default
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-us3-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with account ID
# Send a server-side event linked to an account.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-us3-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"account": {
"id": "account-456"
},
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "checkout.completed"
},
"type": "server"
}
EOF
## Event with custom attributes
# Send a server-side event with additional custom attributes.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-us3-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"customer": {
"tier": "premium"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with session ID
# Send a server-side event linked to a session.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-us3-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "form.submitted"
},
"session": {
"id": "session-789"
},
"type": "server"
}
EOF
## Simple event with user ID
# Send a server-side event linked to a user.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-us3-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF## default
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-us5-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with account ID
# Send a server-side event linked to an account.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-us5-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"account": {
"id": "account-456"
},
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "checkout.completed"
},
"type": "server"
}
EOF
## Event with custom attributes
# Send a server-side event with additional custom attributes.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-us5-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"customer": {
"tier": "premium"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with session ID
# Send a server-side event linked to a session.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-us5-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "form.submitted"
},
"session": {
"id": "session-789"
},
"type": "server"
}
EOF
## Simple event with user ID
# Send a server-side event linked to a user.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-us5-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF## default
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-datadoghq.eu/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with account ID
# Send a server-side event linked to an account.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-datadoghq.eu/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"account": {
"id": "account-456"
},
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "checkout.completed"
},
"type": "server"
}
EOF
## Event with custom attributes
# Send a server-side event with additional custom attributes.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-datadoghq.eu/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"customer": {
"tier": "premium"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with session ID
# Send a server-side event linked to a session.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-datadoghq.eu/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "form.submitted"
},
"session": {
"id": "session-789"
},
"type": "server"
}
EOF
## Simple event with user ID
# Send a server-side event linked to a user.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-datadoghq.eu/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF## default
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-ap1-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with account ID
# Send a server-side event linked to an account.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-ap1-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"account": {
"id": "account-456"
},
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "checkout.completed"
},
"type": "server"
}
EOF
## Event with custom attributes
# Send a server-side event with additional custom attributes.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-ap1-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"customer": {
"tier": "premium"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with session ID
# Send a server-side event linked to a session.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-ap1-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "form.submitted"
},
"session": {
"id": "session-789"
},
"type": "server"
}
EOF
## Simple event with user ID
# Send a server-side event linked to a user.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-ap1-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF## default
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-ap2-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with account ID
# Send a server-side event linked to an account.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-ap2-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"account": {
"id": "account-456"
},
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "checkout.completed"
},
"type": "server"
}
EOF
## Event with custom attributes
# Send a server-side event with additional custom attributes.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-ap2-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"customer": {
"tier": "premium"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with session ID
# Send a server-side event linked to a session.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-ap2-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "form.submitted"
},
"session": {
"id": "session-789"
},
"type": "server"
}
EOF
## Simple event with user ID
# Send a server-side event linked to a user.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-ap2-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF## default
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-uk1-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with account ID
# Send a server-side event linked to an account.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-uk1-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"account": {
"id": "account-456"
},
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "checkout.completed"
},
"type": "server"
}
EOF
## Event with custom attributes
# Send a server-side event with additional custom attributes.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-uk1-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"customer": {
"tier": "premium"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF
## Event with session ID
# Send a server-side event linked to a session.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-uk1-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "form.submitted"
},
"session": {
"id": "session-789"
},
"type": "server"
}
EOF
## Simple event with user ID
# Send a server-side event linked to a user.
# Set your Datadog credentials
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://browser-intake-uk1-datadoghq.com/api/v2/prodlytics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"application": {
"id": "123abcde-123a-123b-1234-123456789abc"
},
"event": {
"name": "payment.processed"
},
"type": "server",
"usr": {
"id": "123"
}
}
EOF// Send server-side events returns "Request accepted for processing (always 202 empty JSON)." response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
body := datadogV2.ProductAnalyticsServerSideEventItem{
Account: &datadogV2.ProductAnalyticsServerSideEventItemAccount{
Id: "account-67890",
},
Application: datadogV2.ProductAnalyticsServerSideEventItemApplication{
Id: "123abcde-123a-123b-1234-123456789abc",
},
Event: datadogV2.ProductAnalyticsServerSideEventItemEvent{
Name: "payment.processed",
},
Session: &datadogV2.ProductAnalyticsServerSideEventItemSession{
Id: "session-abcdef",
},
Type: datadogV2.PRODUCTANALYTICSSERVERSIDEEVENTITEMTYPE_SERVER,
Usr: &datadogV2.ProductAnalyticsServerSideEventItemUsr{
Id: "user-12345",
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewProductAnalyticsApi(apiClient)
resp, r, err := api.SubmitProductAnalyticsEvent(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ProductAnalyticsApi.SubmitProductAnalyticsEvent`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `ProductAnalyticsApi.SubmitProductAnalyticsEvent`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"// Send server-side events returns "Request accepted for processing (always 202 empty JSON)."
// response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ProductAnalyticsApi;
import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItem;
import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemAccount;
import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemApplication;
import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemEvent;
import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemSession;
import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemType;
import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemUsr;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
ProductAnalyticsApi apiInstance = new ProductAnalyticsApi(defaultClient);
ProductAnalyticsServerSideEventItem body =
new ProductAnalyticsServerSideEventItem()
.account(new ProductAnalyticsServerSideEventItemAccount().id("account-67890"))
.application(
new ProductAnalyticsServerSideEventItemApplication()
.id("123abcde-123a-123b-1234-123456789abc"))
.event(new ProductAnalyticsServerSideEventItemEvent().name("payment.processed"))
.session(new ProductAnalyticsServerSideEventItemSession().id("session-abcdef"))
.type(ProductAnalyticsServerSideEventItemType.SERVER)
.usr(new ProductAnalyticsServerSideEventItemUsr().id("user-12345"));
try {
apiInstance.submitProductAnalyticsEvent(body);
} catch (ApiException e) {
System.err.println("Exception when calling ProductAnalyticsApi#submitProductAnalyticsEvent");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java""""
Send server-side events returns "Request accepted for processing (always 202 empty JSON)." response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.product_analytics_api import ProductAnalyticsApi
from datadog_api_client.v2.model.product_analytics_server_side_event_item import ProductAnalyticsServerSideEventItem
from datadog_api_client.v2.model.product_analytics_server_side_event_item_account import (
ProductAnalyticsServerSideEventItemAccount,
)
from datadog_api_client.v2.model.product_analytics_server_side_event_item_application import (
ProductAnalyticsServerSideEventItemApplication,
)
from datadog_api_client.v2.model.product_analytics_server_side_event_item_event import (
ProductAnalyticsServerSideEventItemEvent,
)
from datadog_api_client.v2.model.product_analytics_server_side_event_item_session import (
ProductAnalyticsServerSideEventItemSession,
)
from datadog_api_client.v2.model.product_analytics_server_side_event_item_type import (
ProductAnalyticsServerSideEventItemType,
)
from datadog_api_client.v2.model.product_analytics_server_side_event_item_usr import (
ProductAnalyticsServerSideEventItemUsr,
)
body = ProductAnalyticsServerSideEventItem(
account=ProductAnalyticsServerSideEventItemAccount(
id="account-67890",
),
application=ProductAnalyticsServerSideEventItemApplication(
id="123abcde-123a-123b-1234-123456789abc",
),
event=ProductAnalyticsServerSideEventItemEvent(
name="payment.processed",
),
session=ProductAnalyticsServerSideEventItemSession(
id="session-abcdef",
),
type=ProductAnalyticsServerSideEventItemType.SERVER,
usr=ProductAnalyticsServerSideEventItemUsr(
id="user-12345",
),
)
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = ProductAnalyticsApi(api_client)
response = api_instance.submit_product_analytics_event(body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"# Send server-side events returns "Request accepted for processing (always 202 empty JSON)." response
require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ProductAnalyticsAPI.new
body = DatadogAPIClient::V2::ProductAnalyticsServerSideEventItem.new({
account: DatadogAPIClient::V2::ProductAnalyticsServerSideEventItemAccount.new({
id: "account-67890",
}),
application: DatadogAPIClient::V2::ProductAnalyticsServerSideEventItemApplication.new({
id: "123abcde-123a-123b-1234-123456789abc",
}),
event: DatadogAPIClient::V2::ProductAnalyticsServerSideEventItemEvent.new({
name: "payment.processed",
}),
session: DatadogAPIClient::V2::ProductAnalyticsServerSideEventItemSession.new({
id: "session-abcdef",
}),
type: DatadogAPIClient::V2::ProductAnalyticsServerSideEventItemType::SERVER,
usr: DatadogAPIClient::V2::ProductAnalyticsServerSideEventItemUsr.new({
id: "user-12345",
}),
})
p api_instance.submit_product_analytics_event(body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"// Send server-side events returns "Request accepted for processing (always 202
// empty JSON)." response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_product_analytics::ProductAnalyticsAPI;
use datadog_api_client::datadogV2::model::ProductAnalyticsServerSideEventItem;
use datadog_api_client::datadogV2::model::ProductAnalyticsServerSideEventItemAccount;
use datadog_api_client::datadogV2::model::ProductAnalyticsServerSideEventItemApplication;
use datadog_api_client::datadogV2::model::ProductAnalyticsServerSideEventItemEvent;
use datadog_api_client::datadogV2::model::ProductAnalyticsServerSideEventItemSession;
use datadog_api_client::datadogV2::model::ProductAnalyticsServerSideEventItemType;
use datadog_api_client::datadogV2::model::ProductAnalyticsServerSideEventItemUsr;
#[tokio::main]
async fn main() {
let body = ProductAnalyticsServerSideEventItem::new(
ProductAnalyticsServerSideEventItemApplication::new(
"123abcde-123a-123b-1234-123456789abc".to_string(),
),
ProductAnalyticsServerSideEventItemEvent::new("payment.processed".to_string()),
ProductAnalyticsServerSideEventItemType::SERVER,
)
.account(ProductAnalyticsServerSideEventItemAccount::new(
"account-67890".to_string(),
))
.session(ProductAnalyticsServerSideEventItemSession::new(
"session-abcdef".to_string(),
))
.usr(ProductAnalyticsServerSideEventItemUsr::new(
"user-12345".to_string(),
));
let configuration = datadog::Configuration::new();
let api = ProductAnalyticsAPI::with_config(configuration);
let resp = api.submit_product_analytics_event(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo run/**
* Send server-side events returns "Request accepted for processing (always 202 empty JSON)." response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration();
const apiInstance = new v2.ProductAnalyticsApi(configuration);
const params: v2.ProductAnalyticsApiSubmitProductAnalyticsEventRequest = {
body: {
account: {
id: "account-67890",
},
application: {
id: "123abcde-123a-123b-1234-123456789abc",
},
event: {
name: "payment.processed",
},
session: {
id: "session-abcdef",
},
type: "server",
usr: {
id: "user-12345",
},
},
};
apiInstance
.submitProductAnalyticsEvent(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" tsc "example.ts"