> For the complete documentation index, see [llms.txt](https://docs.lootlocker.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lootlocker.com/game-systems/leaderboards/how-to/use-metadata-to-store-additional-information.md).

# Use Metadata to Store Additional Information

In this scenario, the player has had the opportunity to write / select their country to be displayed on the Leaderboard.

{% tabs %}
{% tab title="Unity" %}

```csharp
string leaderboardKey = "my_leaderboard";
int score = 1000;
string metadata = "country:" + PlayerPrefs.GetString("PlayerAssignedCountry"); // Replace PlayerPrefs.GetString("PlayerAssignedCountry") with an existing way of getting the configured country for the player in your game

LootLockerSDKManager.SubmitScore("", score, leaderboardKey, metadata, (response) =>
{
    if (!response.success) {
        Debug.Log("Could not submit score!");
        Debug.Log(response.errorData.ToString());
        return;
    } 
     Debug.Log("Successfully submitted score!\n with metadata: " + metadata);
});
```

{% endtab %}

{% tab title="Unreal BP" %}

<figure><img src="/files/il0CXwa27Ujs8evAyP6m" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/0kaq77rd/">Blueprint example of submitting a score with country as metadata</a></p></figcaption></figure>
{% endtab %}

{% tab title="Unreal CPP" %}
The header file for the SubmitScoreHandler should look like this:

```cpp
#pragma once

#include "CoreMinimal.h"
#include "LootLockerSDKManager.h"

DECLARE_DELEGATE_OneParam(FOnSubmitScoreResponse, FLootLockerSubmitScoreResponse);

class YOURPROJECTNAME_API SubmitScoreHandler
{
public:
	SubmitScoreHandler();
	void SubmitScore(int score);
	~SubmitScoreHandler();
	
private:
	FString metadata;
	FString leaderboardKey;

	void OnSubmitScoreResponse(FLootLockerSubmitScoreResponse Response);

};
```

The cpp file should look something like this:

```cpp
#include "CountrySubmit.h"

CountrySubmit::CountrySubmit()
{

}

void SubmitScoreHandler::SubmitScore()
{
	metadata = "Country:" + FunctionWhichGetsCountry();

	ULootLockerSDKManager::SubmitScore("", 
		leaderboardKey, 
		score, 
		metadata, 
		FOnSubmitScoreResponse::CreateUObject(this, &CountrySubmit::OnSubmitScoreResponse));
}

void SubmitScoreHandler::OnSubmitScoreResponse(FLootLockerSubmitScoreResponse Response)
{
	if (!Response.success) {
		UE_LOG(LogTemp, Log, TEXT("Error: %d"), Response.ErrorData.Message);
		return;
	}

	UE_LOG(LogTemp, Log, TEXT("Score submitted successfully. Rank: %d"), Response.rank);
}

CountrySubmit::~CountrySubmit()
{

}

```

{% endtab %}

{% tab title="Godot" %}

```gdscript

var metadata : String = "country: " + PlayerInformation.GetPlayerAssignedCountry() # Replace PlayerInformation.GetPlayerAssignedCountry() with an existing method that gets the configured country for the player in your game
var leaderboardKey : String = "my_leaderboard"
var score : int = 1000
var response = await LL_Leaderboards.SubmitScore.new(leaderboardKey, score, "", metadata).send()
if(!response.success) :
	# Request failed, handle errors
	pass
else:
	# Request succeeded, use response as applicable in your game logic
	pass
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lootlocker.com/game-systems/leaderboards/how-to/use-metadata-to-store-additional-information.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
