Compartilhar via


XGameEventWrite

Write an in-game event that optionally includes "dimensions" and "measurement" data fields.

Syntax

HRESULT XGameEventWrite(  
         XUserHandle user,  
         const char *serviceConfigId,  
         const char *playSessionId,  
         const char* eventName,  
         const char* dimensionsJson,  
         const char* measurementsJson  
)  

Parameters

user   _In_
Type: XUserHandle

The User handle to send the event on behalf of.

*serviceConfigId   _In_z_
Type: char

The Xbox Live service config ID (SCID) for this title.

*playSessionId   _In_z_
Type: char

Play Session ID. This is a unique GUID created by the game at the start of each game session to track the set of events sent in a single play session.

eventName   _In_z_
Type: char*

Event name.

dimensionsJson   _In_opt_z_
Type: char*

Dimensions data fields in JSON format.

measurementsJson   _In_opt_z_
Type: char*

Measurement data fields in JSON format.

Return value

Type: HRESULT

Returns S_OK if successful; otherwise, returns an error code. For a list of error codes, see Error Codes.

Remarks

Note

This function isn't safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.

Dimensions include event fields with a finite number of defined numeric or string values. Examples of dimensions: map id, difficulty level, character or weapon class, game mode, boolean settings, etc. Measurements include event fields that represent scalar numeric metrics. Examples of measurements: score, time, counters, position, etc. Example: for an in-game event that tracks the highest match score for a difficulty level: The difficulty level should be included in dimensions, and the score should be included in measurements. The name of the event, and the names of the event fields in both dimensions and measurements, must match the names declared in the title's service configuration. The names are case insensitive. If the API writes an event with a name that does not match a name in the service configuration, the service drops the event with no notification.

Requirements

Header: XGameEvent.h

Library: xgameruntime.lib

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

XGameEvent