SDK
v2.0
v2.0
  • Getting Started
    • Welcome
    • Start Here
    • Postback Payout (S2S)
    • Advanced options
      • Sending Media Source Data
      • Sending User Segments / User Info
  • Unity
    • Installation
    • Initialization
    • Obtaining Adverstising ID's
  • Android
    • Prerequisite
    • Installation
    • Initialization
      • Deeplinking Routes
      • Premium Offers
    • Obtaining Adverstising ID's
  • Flutter
    • Prerequisite
    • Installation
    • Initialization
      • Deeplinking Routes
      • Premium Offers
      • changeLanguage
    • Obtaining Advertising ID's
  • REACT NATIVE
    • Prerequisites
    • Installation
    • Initialization
      • Deeplinking Routes
      • Premium Offers
    • Obtaining Advertising ID's
  • Web / Iframe
    • Initialization
    • Premium Widgets
  • Questions and troubleshooting
    • Reporting bugs
    • Known issues
    • Changelog
Powered by GitBook
On this page
  1. Unity

Initialization

PreviousInstallationNextObtaining Adverstising ID's

Last updated 23 days ago

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:

  • Initiate early: It's advisable to initialize the SDK promptly after your app launches to ensure that all Tyr SDK functionalities are accessible when needed.

  • Initiate post-app authentication: Re-initiate the SDK with current user details immediately after your user signs up or signs in to the app to update the userId.

  • Initiate periodically: To optimize user experience, we strongly suggest invoking this method each time your app is brought to the forefront. This shouldn't impact your app's performance noticeably.

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.