Send server-side events to Product Analytics. Server-Side Events Ingestion allows you to collect custom events
from any server-side source, and retains events for 15 months. Server-side events are helpful for understanding
causes of a funnel drop-off which are external to the client-side (for example, payment processing error).
See the Product Analytics page for more information.
POSTNot supported in the AP1 regionNot supported in the AP2 regionNot supported in the EU regionNot supported in the GOV regionNot supported in the US regionNot supported in the US3 regionNot supported in the US5 region
Présentation
Send server-side events to Product Analytics. Server-side events are retained for 15 months.
Server-Side events in Product Analytics are helpful for tracking events that occur on the server,
as opposed to client-side events, which are captured by Real User Monitoring (RUM) SDKs.
This allows for a more comprehensive view of the user journey by including actions that happen on the server.
Typical examples could be checkout.completed or payment.processed.
Ingested server-side events are integrated into Product Analytics to allow users to select and filter
these events in the event picker, similar to how views or actions are handled.
Requirements:
At least one of usr, account, or session must be provided with a valid ID.
The application.id must reference a Product Analytics-enabled application.
Custom Attributes:
Any additional fields in the payload are flattened and searchable as facets.
For example, a payload with {"customer": {"tier": "premium"}} is searchable with
the syntax @customer.tier:premium in Datadog.
The status codes answered by the HTTP API are:
202: Accepted: The request has been accepted for processing
400: Bad request (likely an issue in the payload formatting)
401: Unauthorized (likely a missing API Key)
403: Permission issue (likely using an invalid API Key)
408: Request Timeout, request should be retried after some time
413: Payload too large (batch is above 5MB uncompressed)
429: Too Many Requests, request should be retried after some time
500: Internal Server Error, the server encountered an unexpected condition that prevented it from fulfilling the request, request should be retried after some time
503: Service Unavailable, the server is not ready to handle the request probably because it is overloaded, request should be retried after some time
DD_SITE="Not supported in the US1 regionNot supported in the US3 regionNot supported in the US5 regionNot supported in the EU regionNot supported in the AP1 regionNot supported in the AP2 regionNot supported in the US1-FED region"DD_API_KEY="<DD_API_KEY>"python3"example.py"
DD_SITE="Not supported in the US1 regionNot supported in the US3 regionNot supported in the US5 regionNot supported in the EU regionNot supported in the AP1 regionNot supported in the AP2 regionNot supported in the US1-FED region"DD_API_KEY="<DD_API_KEY>"rb"example.rb"
// Send server-side events returns "Request accepted for processing (always 202 empty JSON)." responsepackagemainimport("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")funcmain(){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)iferr!=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)}
DD_SITE="Not supported in the US1 regionNot supported in the US3 regionNot supported in the US5 regionNot supported in the EU regionNot supported in the AP1 regionNot supported in the AP2 regionNot supported in the US1-FED region"DD_API_KEY="<DD_API_KEY>"go run"main.go"
DD_SITE="Not supported in the US1 regionNot supported in the US3 regionNot supported in the US5 regionNot supported in the EU regionNot supported in the AP1 regionNot supported in the AP2 regionNot supported in the US1-FED region"DD_API_KEY="<DD_API_KEY>"java"Example.java"
DD_SITE="Not supported in the US1 regionNot supported in the US3 regionNot supported in the US5 regionNot supported in the EU regionNot supported in the AP1 regionNot supported in the AP2 regionNot supported in the US1-FED region"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";constconfiguration=client.createConfiguration();constapiInstance=newv2.ProductAnalyticsApi(configuration);constparams: 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));
DD_SITE="Not supported in the US1 regionNot supported in the US3 regionNot supported in the US5 regionNot supported in the EU regionNot supported in the AP1 regionNot supported in the AP2 regionNot supported in the US1-FED region"DD_API_KEY="<DD_API_KEY>"tsc"example.ts"
Compute scalar analytics results for Product Analytics data.
Returns aggregated values (counts, averages, percentiles) optionally grouped by facets.
This endpoint requires the rum_apps_read permission.
Override the query execution strategy.
Allowed enum values: simple,background,trino-multistep,materialized-view
from [required]
int64
Start time in epoch milliseconds. Must be less than to.
query [required]
object
The analytics query definition containing a base query, compute rule, and optional grouping.
audience_filters
object
Audience filter definitions for targeting specific user segments.
accounts
[object]
Account audience queries.
name [required]
string
Name of this query, referenced in the formula.
query
string
Search query for filtering accounts.
formula
string
Boolean formula combining audience queries by name.
segments
[object]
Segment audience queries.
name [required]
string
Name of this query, referenced in the formula.
segment_id [required]
uuid
UUID of the segment to filter by.
users
[object]
User audience queries.
name [required]
string
Name of this query, referenced in the formula.
query
string
Search query for filtering users.
compute [required]
object
A compute rule for aggregating data.
aggregation [required]
string
The aggregation function (count, cardinality, avg, sum, min, max, etc.).
interval
int64
Time bucket size in milliseconds. Required for timeseries queries.
metric
string
The metric to aggregate on. Required for non-count aggregations.
group_by
[object]
Group-by rules for segmenting results.
facet [required]
string
The facet to group by.
limit
int64
Maximum number of groups to return.
should_exclude_missing
boolean
Exclude results with missing facet values.
sort
object
Sort configuration for group-by results.
aggregation
string
The aggregation function to sort by.
metric
string
The metric to sort by.
order
enum
Direction of sort.
Allowed enum values: asc,desc
default: desc
source
string
The source for audience-filter-based group-by.
indexes
[string]
Restrict the query to specific indexes. Max 1 entry.
query [required]
<oneOf>
A query definition discriminated by the data_source field.
Use product_analytics for standard event queries, or
product_analytics_occurrence for occurrence-filtered queries.
Option 1
object
A standard Product Analytics event query.
data_source [required]
enum
The data source identifier.
Allowed enum values: product_analytics
search [required]
object
Search parameters for an event query.
query
string
The search query using Datadog search syntax.
Option 2
object
A Product Analytics occurrence-filtered query.
data_source [required]
enum
The data source identifier for occurrence queries.
Allowed enum values: product_analytics_occurrence
search [required]
object
Search parameters for an occurrence query.
occurrences
object
Filter for occurrence-based queries.
meta
object
Additional metadata.
<any-key>
string
operator [required]
string
Comparison operator (=, >=, <=, >, <).
value [required]
string
The occurrence count threshold as a string.
query
string
The search query using Datadog search syntax.
request_id
string
Optional request ID for multi-step query continuation.
to [required]
int64
End time in epoch milliseconds.
type [required]
enum
The resource type for analytics requests.
Allowed enum values: formula_analytics_extended_request
Compute timeseries analytics results for Product Analytics data.
Returns time-bucketed values for charts and trend analysis.
The compute.interval field (milliseconds) is required for time bucketing.
This endpoint requires the rum_apps_read permission.
Override the query execution strategy.
Allowed enum values: simple,background,trino-multistep,materialized-view
from [required]
int64
Start time in epoch milliseconds. Must be less than to.
query [required]
object
The analytics query definition containing a base query, compute rule, and optional grouping.
audience_filters
object
Audience filter definitions for targeting specific user segments.
accounts
[object]
Account audience queries.
name [required]
string
Name of this query, referenced in the formula.
query
string
Search query for filtering accounts.
formula
string
Boolean formula combining audience queries by name.
segments
[object]
Segment audience queries.
name [required]
string
Name of this query, referenced in the formula.
segment_id [required]
uuid
UUID of the segment to filter by.
users
[object]
User audience queries.
name [required]
string
Name of this query, referenced in the formula.
query
string
Search query for filtering users.
compute [required]
object
A compute rule for aggregating data.
aggregation [required]
string
The aggregation function (count, cardinality, avg, sum, min, max, etc.).
interval
int64
Time bucket size in milliseconds. Required for timeseries queries.
metric
string
The metric to aggregate on. Required for non-count aggregations.
group_by
[object]
Group-by rules for segmenting results.
facet [required]
string
The facet to group by.
limit
int64
Maximum number of groups to return.
should_exclude_missing
boolean
Exclude results with missing facet values.
sort
object
Sort configuration for group-by results.
aggregation
string
The aggregation function to sort by.
metric
string
The metric to sort by.
order
enum
Direction of sort.
Allowed enum values: asc,desc
default: desc
source
string
The source for audience-filter-based group-by.
indexes
[string]
Restrict the query to specific indexes. Max 1 entry.
query [required]
<oneOf>
A query definition discriminated by the data_source field.
Use product_analytics for standard event queries, or
product_analytics_occurrence for occurrence-filtered queries.
Option 1
object
A standard Product Analytics event query.
data_source [required]
enum
The data source identifier.
Allowed enum values: product_analytics
search [required]
object
Search parameters for an event query.
query
string
The search query using Datadog search syntax.
Option 2
object
A Product Analytics occurrence-filtered query.
data_source [required]
enum
The data source identifier for occurrence queries.
Allowed enum values: product_analytics_occurrence
search [required]
object
Search parameters for an occurrence query.
occurrences
object
Filter for occurrence-based queries.
meta
object
Additional metadata.
<any-key>
string
operator [required]
string
Comparison operator (=, >=, <=, >, <).
value [required]
string
The occurrence count threshold as a string.
query
string
The search query using Datadog search syntax.
request_id
string
Optional request ID for multi-step query continuation.
to [required]
int64
End time in epoch milliseconds.
type [required]
enum
The resource type for analytics requests.
Allowed enum values: formula_analytics_extended_request