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

# Game Stats Widgets

> Display game stats like rank, playtime, and wins on Discord user profiles using the Application Identity Profile API.

export const WrenchIcon = props => <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="currentColor" d="M7.8 15.77c.7.43 1.2 1.14 1.2 1.96V21a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-3.27c0-.82.5-1.53 1.2-1.96a8.06 8.06 0 0 0 .12-13.63c-.6-.39-1.32.09-1.32.8v5.98a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V2.94c0-.71-.72-1.19-1.32-.8a8.06 8.06 0 0 0 .12 13.63Z" /></svg>;

export const UserStatusIcon = props => <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="currentColor" d="M16 6a4 4 0 1 1-8 0 4 4 0 0 1 8 0ZM2 20.53A9.53 9.53 0 0 1 11.53 11h.94c1.28 0 2.5.25 3.61.7.41.18.36.77-.05.96a7 7 0 0 0-3.65 8.6c.11.36-.13.74-.5.74H6.15a.5.5 0 0 1-.5-.55l.27-2.6c.02-.26-.27-.37-.41-.16-.48.74-1.03 1.8-1.32 2.9a.53.53 0 0 1-.5.41h-.22C2.66 22 2 21.34 2 20.53Z" /><path fill="currentColor" d="M24 19a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z" /></svg>;

export const UserPlusIcon = props => <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="currentColor" d="M19 14a1 1 0 0 1 1 1v3h3a1 1 0 0 1 0 2h-3v3a1 1 0 0 1-2 0v-3h-3a1 1 0 1 1 0-2h3v-3a1 1 0 0 1 1-1Z" /><path fill="currentColor" d="M16.83 12.93c.26-.27.26-.75-.08-.92A9.5 9.5 0 0 0 12.47 11h-.94A9.53 9.53 0 0 0 2 20.53c0 .81.66 1.47 1.47 1.47h.22c.24 0 .44-.17.5-.4.29-1.12.84-2.17 1.32-2.91.14-.21.43-.1.4.15l-.26 2.61c-.02.3.2.55.5.55h7.64c.12 0 .17-.31.06-.36C12.82 21.14 12 20.22 12 19a3 3 0 0 1 3-3h.5a.5.5 0 0 0 .5-.5V15c0-.8.31-1.53.83-2.07ZM12 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z" /></svg>;

export const TrophyIcon = props => <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="currentColor" fill-rule="evenodd" d="M8 20a1 1 0 0 0-1 1v.5c0 .28.22.5.5.5h9a.5.5 0 0 0 .5-.5V21a1 1 0 0 0-1-1h-1a2 2 0 0 1-2-2v-.48c0-.95.7-1.73 1.5-2.23a5.7 5.7 0 0 0 1.23-1.08l2.3-.7A7 7 0 0 0 23 6.81V6a2 2 0 0 0-2-2h-2.24A2.85 2.85 0 0 0 16 2H8c-1.3 0-2.43.84-2.76 2H3a2 2 0 0 0-2 2v.82a7 7 0 0 0 4.96 6.7l2.31.7c.37.42.79.78 1.24 1.07.8.5 1.49 1.28 1.49 2.23V18a2 2 0 0 1-2 2H8Zm9.29-8.35.17-.05A5 5 0 0 0 21 6.82V6h-2.27a21.75 21.75 0 0 1-1.44 5.65Zm-10.58 0-.17-.05A5 5 0 0 1 3 6.82V6h2.27c.25 1.94.7 3.95 1.44 5.65Z" clip-rule="evenodd" /></svg>;

<img src="https://mintcdn.com/discord/R8r24NMiTZ5d0pjm/images/social-layer/game-stats/widget.png?fit=max&auto=format&n=R8r24NMiTZ5d0pjm&q=85&s=a9203f00858a7ae41decce02b63172d1" alt="Game Stats Widget" style={{width: "60%", height: "auto"}} noZoom width="432" height="329" data-path="images/social-layer/game-stats/widget.png" />

Game Stats Widgets let players show off their progress, such as rank, playtime, wins, and any custom stat you define, right on their Discord profile. Friends can see live updates of those stats, which keeps your game visible outside of play sessions and gives players new ways to show off their progress.

<Note>
  Game Stats Widgets are available to games that have been claimed on Discord. Claiming your game verifies you as the game's official developer, so only you can control how your Game Stats Widget is represented across Discord. Complete [Game Claiming](https://docs.discord.com/developers/platform/claim-your-game) before you configure your widget.
</Note>

Game Stats Widgets are powered by an API that uses your application's bot token to read and write profile data on behalf of your players. It requires that the player has linked their Discord account to your game. See [Account Linking on Web](/developers/discord-social-sdk/development-guides/account-linking-on-web) for details on how to link accounts.

Game data is stored as part of a user's **Application Identity**, a record of the user's identity in your game, keyed by your application ID, the user's Discord ID, and the user's ID in your system. See the [Application Identity Profile Resource](/developers/resources/application-identity-profile) for full object and endpoint reference.

<Tip>
  The Application Identity Profile endpoints can only be called for users who have authorized your application with the `application_identities.write` scope. If you are building a Social SDK integration, this scope is included in the [Social SDK scopes](/developers/discord-social-sdk/core-concepts/oauth2-scopes). See [Account Linking on Web](/developers/discord-social-sdk/development-guides/account-linking-on-web) for the linking flow.
</Tip>

## How Game Stats Widgets Work

1. **Configure your widget** in the Developer Portal — choose a layout for each surface and set up which fields to display
2. **Players link their Discord account** to your game via OAuth2, granting your application permission to write to their profile
3. **Your game server sends player stats** to the Application Identity Profile API using your bot token
4. **Players add your widget to their profile** to share their stats with friends

There are two categories of stats you can provide:

* **Primary data**: pre-configured fields with fixed keys defined by Discord (`rank_name`, `total_wins`, `playtime_hours`, etc.). Populate the ones that best fit your game and genre.
* **Dynamic data**: custom fields you define with your own name and value, for stats that aren't covered by the primary set. Supports string, number, and media types.

You can send both in the same API payload, under `data.primary` and `data.dynamic`. In the widget editor, you can reference any of the provided data by setting a field's Value Type to **User Data** and entering the key (the primary field name or the dynamic field's `name`).

Check out [Choosing What to Display](/developers/social-layer/game-stats-widgets/best-practices) for guidance on which stats work best on Discord profiles, and the [Application Identity Profile Resource](/developers/resources/application-identity-profile) for the full field reference.

## Prerequisites

Before you begin, make sure you have:

* **Discord application set up**
  * Created a Discord application in the [Developer Portal](https://discord.com/developers/applications)
  * A bot token from the Bot section of your application dashboard
* **Social SDK enabled**
  * Enabled the Discord Social SDK for your application in the [Developer Portal](https://discord.com/developers/applications) and agreed to the Discord Social SDK Terms
* **Claimed your game on Discord**
  * Your game must be claimed on Discord from the Developer Portal. See [Game Claiming](https://docs.discord.com/developers/platform/claim-your-game) for eligibility and steps.
  * If you have agreed to the Discord Social SDK Terms and don't see **Games > Widget** in the Developer Portal sidebar, your game has likely not been claimed yet.
* **Account linking configured**
  * Implemented [Account Linking on Web](/developers/discord-social-sdk/development-guides/account-linking-on-web) with the necessary `application_identities.write` scope in your OAuth2 flow

<Tip>
  If you are building a [Social SDK integration](/developers/discord-social-sdk/overview), the [Social SDK scopes](/developers/discord-social-sdk/core-concepts/oauth2-scopes) already include the `application_identities.write` scopes for you.
</Tip>

## Next Steps

<CardGroup cols={2}>
  <Card title="Widget Configuration" href="/developers/social-layer/game-stats-widgets/widget-configuration" icon={<WrenchIcon/>}>
    Set up your widget's layouts and fields in the Developer Portal.
  </Card>

  <Card title="Sending Game Data" href="/developers/social-layer/game-stats-widgets/sending-game-data" icon={<TrophyIcon/>}>
    Authorize requests and send profile data to the Application Identity Profile API.
  </Card>

  <Card title="Best Practices" href="/developers/social-layer/game-stats-widgets/best-practices" icon={<UserStatusIcon/>}>
    When to sync data and how to present your widget to users.
  </Card>

  <Card title="Web Account Linking" href="/developers/discord-social-sdk/development-guides/account-linking-on-web" icon={<UserPlusIcon/>}>
    Let players link their Discord account to your game so you can write to their profile.
  </Card>
</CardGroup>
