Skip to main content

Connect custom services to Game Telemetry using server SDKs

Last updated on December 23, 2024
AGS Shared Cloud

Game Telemetry is not available on AGS Shared Cloud tier.

Introduction

You can connect your custom services to the Game Telemetry service using server SDKs and configure them to communicate with the AccelByte backend.

Connect custom services to Game Telemetry using Server SDKs

SDK initialization

Before using the Game Telemetry service from the SDK, you will need to initialize your server-side SDK to ensure that you are authorized, and able to perform create, read, update, and delete actions.

Golang SDK initialization

Before using the Game Telemetry service from the Golang SDK, you will need to initialize the SDK by following the steps below:

  1. Create your OAuth Client. The Game Telemetry endpoint doesn't require any permissions.

  2. Log in as a client using the SDK.

  3. Initialize the Game Telemetry service using the following function:

    operationsService := &gametelemetry.OperationsService{
    Client: factory.NewGametelemetryClient(&repository.ConfigRepositoryImpl{}),
    TokenRepository: &repository.TokenRepositoryImpl{},
    }

Once completed, you can use the Golang SDK to create, read, update, or delete Game Telemetry from your serverless app.

Send Events

Use the following code to send events into designated streaming pipelines:

errInput := operationsService.ProtectedSaveEventsGameTelemetryV1ProtectedEventsPost(input)
if errInput != nil {
return errInput
}
return nil

Retrieve a player's total playtime

Use the following function to retrieve a player's total playtime in Steam for a specific game. This endpoint will also store the player's total playtime in the service cache. Set the player's Steam account to public so the Game Telemetry service can retrieve their total playtime data.

ok, err := operationsService.ProtectedGetPlaytimeGameTelemetryV1ProtectedSteamIdsSteamIDPlaytimeGet(input)
if err != nil {
return err
}
return nil

Update a player's total playtime

Use the following function to update a player's total playtime in Steam for a specific game in the service cache.

errInput := operationsService.ProtectedUpdatePlaytimeGameTelemetryV1ProtectedSteamIdsSteamIDPlaytimePlaytimePut(input)
if errInput != nil {
return errInput
}
return nil