> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XblEventsWriteInGameEvent

> XblEventsWriteInGameEvent

# XblEventsWriteInGameEvent

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

## Syntax

```cpp theme={null}
HRESULT XblEventsWriteInGameEvent(  
         XblContextHandle xboxLiveContext,  
         const char* eventName,  
         const char* dimensionsJson,  
         const char* measurementsJson  
)  
```

### Parameters

*xboxLiveContext*   \_In\_\
Type: [XblContextHandle](/reference/live/xsapi-c/types_c/handles/xblcontexthandle)

XBOX Live context handle.

*eventName*   \_In\_z\_\
Type: char\*

Event name. Must be contain only alphanumeric characters.

*dimensionsJson*   \_In\_opt\_z\_\
Type: char\*

Dimensions data fields.

*measurementsJson*   \_In\_opt\_z\_\
Type: char\*

Measurement data fields.

### Return value

Type: HRESULT

HRESULT return code for this API operation.

## Remarks

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 particular 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 (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. When using the GDK PC version, a GRTS runtime with the XGameEvent feature must be installed or this will E\_NOTIMPL.

<Note>Measurements can only have numerical values, while Dimensions can have a wider variety of types. If preferred, the *dimensionsJson* field can be used exclusively for writing events.</Note>

## Requirements

**Header:** events\_c.h

**Library:** Microsoft.Xbox.Services.14x.GDK.C.lib

## See also

[events\_c](/reference/live/xsapi-c/events_c/events_c_members)


## Related topics

- [Sending an event](/services/xbox-services/player-data/stats-leaderboards/event-based/events/how-to/live-sending-an-event.md)
- [Writing an event to power an event-based achievement](/services/xbox-services/player-data/achievements/event-based/how-to/live-writing-event-based-achievement.md)
- [Writing an event to power an event-based stat](/services/xbox-services/player-data/stats-leaderboards/event-based/how-to/live-sending-eb-stat.md)
- [First glance for event-based Stats](/services/xbox-services/player-data/stats-leaderboards/event-based/config/live-stats-first-glance.md)
- [Events overview](/services/xbox-services/player-data/stats-leaderboards/event-based/events/live-game-events.md)
