Initialization

Integrating TyrAds Offerwall

Integrating the TyrAds Offerwall into your application is a simple process that involves a few essential steps. By following these instructions, you can seamlessly incorporate the offerwall feature, enhancing user engagement and potentially generating additional revenue for your game.

1. Setting Up

1.a Adding Credentials via the Editor

To enable communication between your app and TyrAds' servers, you must provide the API Key and API Secret, which can be obtained from the TyrAds platform.

Once TyrSDK is imported, follow these steps to configure it for your project:

  • Open the Configuration Window

    • Navigate to Window > TyrSDK Settings to access the TyrSDK Settings panel.

  • Enter Your Credentials

    • API Key: A 32-character hexadecimal string.

    • API Secret: A 92-character hexadecimal string.

These credentials ensure secure communication between your application and the TyrAds platform.

1.b Adding Credentials via the Code

  • Uncheck Auto Initialize Plugin.

  • Make sure to call

TyrSDKPlugin.Instance.SetCredentials("API_KEY", "API_SECRET");

before calling:

TyrSDKPlugin.Instance.Initialize();

This ensures that your credentials are properly set before the initialization process begins.

2. Initialization

SDK Initialization best practices:

To initialize TyrSDK, a User ID is required.

TyrSDK Integration Guide

This guide explains how to integrate TyrSDK into your project, ensuring proper initialization and offer display.

For reference, see the example located in: TyrAdsSDK → Example


1. User Identification

Before initializing the SDK, check if a user ID already exists (optional):

string userId = TyrSDKPlugin.Instance.GetUserId(); // Optional: Can be skipped if always providing a user ID.

Scenario 1: First-Time Initialization

If no user ID exists (i.e., the first time the app is used), obtain one from the appropriate source:

if (string.IsNullOrEmpty(userId))  
{  
    userId = /* Retrieve or generate a user ID (e.g., from user input, backend, or another source) */;
}  

2. SDK Initialization

Once a user ID is available, initialize the SDK:

TyrSDKPlugin.Instance.Initialize(userId);

Scenario 2: Handling User ID Changes

  • If this is the first time the SDK is initialized, the provided user ID is stored and used for all future sessions.

  • If an ID is already set, it cannot be changed later. Any new ID provided after initialization will be ignored.


3. Display Offers

Note: Only portrait mode is supported

To display offers call:

TyrSDKPlugin.Instance.Show();

Scenario 3: Ensuring Authorization

  • The SDK will only show offers if the user is properly initialized.

  • If required credentials (e.g., User ID, API Key, API Secret) are missing, the request will not proceed.

  • This ensures security and prevents unauthorized access.

Last updated