> For the complete documentation index, see [llms.txt](https://docs.digitalturbine.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalturbine.com/dt-fairbid/fairbid-sdk/sdk-reference/custom-parameters-when-showing-an-ad.md).

# Custom Parameters When Showing an Ad

Custom parameters are user-defined data—such as demographics, ad category, or campaign details—which track ad completions. If your rewarding strategy is [Server-Side Rewarding](https://docs.digitalturbine.com/dt-fairbid/advanced-configurations/server-side-rewarding.md), you can add these parameters with Interstitial or Rewarded ad completions to improve tracking and reporting accuracy in [User Level Reports](https://docs.digitalturbine.com/dt-fairbid/reporting/reporting-api/dt-fairbid-user-level-reporting-api.md).

## Defining Custom Parameters <a href="#h_01jppza3xj47necyavt2qaf4hj" id="h_01jppza3xj47necyavt2qaf4hj"></a>

To define and implement custom parameters, use the following API:

{% tabs %}
{% tab title="Android" %}
{% code title="Java" %}

```java
public class ShowOptions {
    public void setCustomParameters(
        Map<String, String> customParameters) {}
}
public void show(
    @NonNull String placementId,
    final ShowOptions showOptions,
    final Activity activity) {}
```

{% endcode %}
{% endtab %}

{% tab title="iOS" %}
{% code title="Swift" %}

```swift
open class FYBShowOptions : NSObject {
    open var customParameters: [String : String]?
}
```

{% endcode %}
{% endtab %}

{% tab title="Unity" %}
{% code title="C#" %}

```csharp
public ShowOptions(Dictionary<string, string> customParameters)

public static void Show(string placementId, ShowOptions options)
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Interstitial Ads

To set custom parameters in Interstitial ads, use the following API:

{% tabs %}
{% tab title="Android" %}
{% code title="Java" %}

```java
Map<String, String> customParams = customParams();
ShowOptions showOptions = new ShowOptions();
showOptions.setCustomParameters(customParams);
Interstitial.show(placementId, showOptions, activity);
```

{% endcode %}
{% endtab %}

{% tab title="iOS" %}
{% code title="Swift" %}

```swift
let showOptions = FYBShowOptions()
showOptions.customParameters = [\
    "myCustomKey": "myCustomValue",\
    "anotherCustomKey": "anotherCustomValue"]
FYWInterstitial.show(
    "placementID",
    options: showOptions)
```

{% endcode %}
{% endtab %}

{% tab title="Unity" %}
{% code title="C#" %}

```csharp
Dictionary<string, string> customParameters = new Dictionary<string, string>();
customParameters.Add("myCustomKey", "myCustomValue");
customParameters.Add("anotherCustomKey", "anotherCustomValue");
ShowOptions options = new ShowOptions(customParameters);
Interstitial.Show(
    "placementID",
    options);
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Rewarded Ads

To set custom parameters in Rewarded ads, use the following API:

{% tabs %}
{% tab title="Android" %}
{% code title="Java" %}

```java
Map<String, String> customParams = customParams();
ShowOptions showOptions = new ShowOptions();
showOptions.setCustomParameters(customParams);
Rewarded.show(placementId, showOptions, activity);
```

{% endcode %}
{% endtab %}

{% tab title="iOS" %}
{% code title="Swift" %}

```swift
let showOptions = FYBShowOptions()
showOptions.customParameters = [\
    "myCustomKey": "myCustomValue",\
    "anotherCustomKey": "anotherCustomValue"]
FYWRewarded.show(
    "placementID",
    options: showOptions)
```

{% endcode %}
{% endtab %}

{% tab title="Unity" %}
{% code title="C#" %}

```csharp
Dictionary<string, string> customParameters = new Dictionary<string, string>();
customParameters.Add("myCustomKey", "myCustomValue");
customParameters.Add("anotherCustomKey", "anotherCustomValue");
RewardedOptions rewardedOptions = new RewardedOptions(
    customParameters);
Rewarded.Show(
    "placementID",
    rewardedOptions);
```

{% endcode %}
{% 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digitalturbine.com/dt-fairbid/fairbid-sdk/sdk-reference/custom-parameters-when-showing-an-ad.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
