Welcome to the Fyber Unity Developer Portal

Let's get started.


Integrating the Plugin

Adding the Fyber Unity Plugin to your Project

It's now time to set up our environment before we start to code.

  1. Download the latest version of the Fyber Unity Plugin. Feel free to check the changelog.

  2. Import the provided FyberUnityPlugin-xxx.unitypackage assets package into your project by clicking on Assets → Import Package → Custom Package, from the Unity Editor.

Please Note

The Unity package includes files for both platforms, iOS and Android.

Please Note!

If you are updating from a previous plugin version, it's recommended to delete the plugin files from your project before importing the new version.

There are additional steps to setup if you are going to deploy for Android, just click the box below; otherwise, you can continue to the next steps.

Step 2: Adding User Consent And Consent Data

The General Data Protection Regulation requires you to scope your user's consent. A user is within the GDPR scope for your app when one or all of the following apply:

  • The user is currently located in the EU
  • The user has registered with the app as an EU resident
  • The app is specifically targeted to EU users

Once you have collected the user’s consent and/or consent string, you can pass them onto the SDK using the following API:


Dictionary<string, string> gdprConsentData = getGdprConsentDataFromUser();

isGdprConsentGiven is a boolean. It is true if you have the user’s consent. If you do not have the user's consent, it is false.

When passing an actual Consent String please use the "gdpr_consent_string" dictionary key only.
context is a valid Android Context.
If you don’t pass the user’s consent to the SDK, only contextual ads will be shown to that user.

In order to clear consent flag and consent data the following API can be used:


We recommend that the first time you gather the user’s consent, you pass it onto the SDK before starting the SDK. The SDK will then take the user’s consent into consideration when initializing. In the following sessions, you will only need to call the API if the user updates his or her consent.

More information on GDPR can be found under the GDPR Resource Page and FAQs.

Step 3: Starting the Plugin

You’ll need to start the Fyber Unity Plugin before being able to use any Fyber product.


Starting up the Fyber SDK when the main thread is performing a heavy operation (loading assets, etc) can result in an unresponsive state (for example, an ANR). This may lead to the app being down ranked in the app store. This is especially true for slower devices. For these reasons, It is advised to initialize the Fyber SDK after all the heavy operations are completed.

To do this, determine a point in your application’s code that runs when the application starts and add the following code to that script.

First, include the FyberPlugin namespace.

using FyberPlugin;

Now start the Fyber Unity Plugin!


The securityToken and appId are required, and can be found in the Settings of your app in the Dashboard. The userId should uniquely identify the user of your app.

Common Error!

Fyber requires user ids to be unique within your app. You may not hardcode or share user ids. If necessary, the Fyber Unity Plugin can assign unique user ids for you (see below).

Automatically Generated user ids

If you do not want to set a userId yourself and would rather the Fyber Unity Plugin create it for you, the Fyber Unity Plugin will do so when you omit the call to .withUserId in your code:

using FyberPlugin;



This generates the required unique userId on the first launch of the application and stores it for subsequent launches.

Subsequent usage of the Fyber Unity Plugin during your application's lifecycle will reuse the parameters passed to this call. If the user re-installs the app, a new userId will be generated.

Please Note!

Omit the userId is not Fyber's preferred method to start the Fyber Unity Plugin, especially if you are planning to user server-side callbacks to handle the user rewarding.

Handling Native Exceptions

You can subscribe to the event FyberCallback.NativeError to catch and handle exceptions occurring within the native Plugin.

void OnEnable()
    FyberCallback.NativeError += OnNativeExceptionReceivedFromSDK;

void OnDisable()
    FyberCallback.NativeError -= OnNativeExceptionReceivedFromSDK;

public void OnNativeExceptionReceivedFromSDK(string message)
    //handle exception

Fyber Logger

You can check if the Fyber Unity Plugin is starting, and other products (added later) are working as expected, looking at the logs. Check the next section for Reference: Fyber Logging.

You are now ready to start using Fyber's products!

Not sure which products you'd like to use? Please review the Introducing Our Products section for a discussion of the benefits of all Fyber products.

Integrating the Plugin

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.