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

# XblUserStatisticsAddStatisticChangedHandler

> XblUserStatisticsAddStatisticChangedHandler

Registers an event handler for statistic change notifications. Event handlers receive a XblStatisticChangeEventArgs object.

## Syntax

```cpp theme={null}
XblFunctionContext XblUserStatisticsAddStatisticChangedHandler(  
         XblContextHandle xblContextHandle,  
         XblStatisticChangedHandler handler,  
         void* handlerContext  
)  
```

### Parameters

*xblContextHandle*   \_In\_\
Type: [XblContextHandle](https://docs.xbox.com/reference/live/xsapi-c/types_c/handles/xblcontexthandle.md)

XBOX services context for the local user.

*handler*   \_In\_\
Type: [XblStatisticChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/user_statistics_c/functions/xblstatisticchangedhandler.md)

The callback function that receives notifications.

*handlerContext*   \_In\_opt\_\
Type: void\*

Client context pointer to be passed back to the handler.

### Return value

Type: XblFunctionContext

A XblFunctionContext object that can be used to unregister the event handler.

## Remarks

The handler receives updates only for statistics that you track by calling [XblUserStatisticsTrackStatistics](https://docs.xbox.com/reference/live/xsapi-c/user_statistics_c/functions/xbluserstatisticstrackstatistics.md). You can change the set of tracked statistics independently of your handlers. To stop receiving updates, call [XblUserStatisticsStopTrackingStatistics](https://docs.xbox.com/reference/live/xsapi-c/user_statistics_c/functions/xbluserstatisticsstoptrackingstatistics.md) or [XblUserStatisticsRemoveStatisticChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/user_statistics_c/functions/xbluserstatisticsremovestatisticchangedhandler.md).

## Requirements

**Header:** user\_statistics\_c.h

**Library:** Microsoft.Xbox.Services.142.C.lib or Microsoft.Xbox.Services.143.C.lib

## See also

[user\_statistics\_c](https://docs.xbox.com/reference/live/xsapi-c/user_statistics_c/user_statistics_c_members.md)\
[XblStatisticChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/user_statistics_c/functions/xblstatisticchangedhandler.md)\
[XblUserStatisticsRemoveStatisticChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/user_statistics_c/functions/xbluserstatisticsremovestatisticchangedhandler.md)\
[XblUserStatisticsTrackStatistics](https://docs.xbox.com/reference/live/xsapi-c/user_statistics_c/functions/xbluserstatisticstrackstatistics.md)\
[Programming the RTA service](https://docs.xbox.com/services/xbox-services/fundamentals/rta/how-to/live-programming-rta.md)\
[Handle an event-based stat change](https://docs.xbox.com/services/xbox-services/player-data/stats-leaderboards/event-based/how-to/live-handling-eb-stat-change.md)


## Related topics

- [XblStatisticChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/user_statistics_c/functions/xblstatisticchangedhandler.md)
- [XblUserStatisticsTrackStatistics](https://docs.xbox.com/reference/live/xsapi-c/user_statistics_c/functions/xbluserstatisticstrackstatistics.md)
- [Programming the RTA service](https://docs.xbox.com/services/xbox-services/fundamentals/rta/how-to/live-programming-rta.md)
- [Handle an event-based stat change](https://docs.xbox.com/services/xbox-services/player-data/stats-leaderboards/event-based/how-to/live-handling-eb-stat-change.md)
- [Best practices for calling XBOX services](https://docs.xbox.com/services/xbox-services/develop/best-practices/live-best-practices-calling-xbl.md)
