> 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](/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](/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 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.digitalturbine.com/dt-fairbid/fairbid-sdk/sdk-reference/custom-parameters-when-showing-an-ad.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.
