Initialization
Integrating the TyrAds offerwall functionality into your application is a straightforward process that involves a few key steps. By following these integration steps, you can seamlessly incorporate the offerwall feature, enhancing user engagement and potentially generating additional revenue for your application.
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 authentication: Login to the SDK with current user details immediately after your user signs up or signs in to the app to set the
userId.
For guidance on integrating TyrSDK - including proper initialization and offer display - see the example at Sample -> Demo:
1. Scene setup
Add the TyrSDKPlugin prefab to your initial scene:
Packages/com.tyrads.unity-sdk/Runtime/Prefabs/TyrSDKPlugin.prefabThis enables API access via SDKPlugin.Instance in code.
2. Initialization
This step initializes the Tyrads SDK within your application. You need to provide the API key and API secret obtained from the Tyrads platform. This allows your app to communicate securely with Tyrads' servers.
a. Adding Credentials via the Editor
Once TyrSDK is imported, follow these steps to configure it for your project:
Open the Configuration Window
Navigate to TyrSDK > 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.
Encryption Key: A 32-character hexadecimal string.

b. Adding Credentials via the Code
Make a call:
TyrSDKPlugin.Instance.Init("API_KEY", "API_SECRET", "ENCRYPTION_KEY");before making a LoginUser call. This ensures that your credentials are properly set before the initialization process begins.
3. User Login
Upon initializing the SDK, the mandatory step is to log in the user. However, passing a user ID is optional and is only necessary when the publisher operates its own user system. This login process ensures that user interactions with the offerwall are accurately tracked and attributed within the application.
TyrSDKPlugin.Instance.LoginUser(userId); //userID is optionalIf you do not provide a user ID, it will be generated automatically and stored in app storage. In that case, uninstalling the app will erase the ID and the user’s progress.
Preferred: supply a backend-controlled, stable user ID (or equivalent) so progress persists across reinstalls and device changes.
To receive the initialization completion result, subscribe to the event before calling LoginUser:
TyrSDKPlugin.Instance.InitializationCompleted += OnSdkInitializationCompleted;
...
private void OnSdkInitializationCompleted(bool isSuccess)
{
// your code here
}If you don’t set a user ID in LoginUser, you can retrieve the generated user ID after successful initialization by calling the following method:
var userId = TyrSDKPlugin.Instance.GetUserId();3.1 Advanced Practices for personalized rewards
To maximize the value to the user sending us more data about the user and where they came from allow us to customize the reward experience. This can be used to provide feedback of quality of users aswell as customize the earnings journey of different segments of users.
To maximize the value of our Tyr SDK please follow the advanced options for user login. This will allow us to personalize the rewards for the user event further and maximize the earnings for you as publisher.
var userInfo = new TyradsUserInfo(
userPhoneNumber: "+1234567890",
userEmail: "[email protected]",
userGroup: "premium_users"
);
var mediaSourceInfo = new TyradsMediaSourceInfo(
mediaSourceName: "Facebook", //mandatory
mediaCampaignName: "Summer Sale Campaign",
mediaSourceId: "fb_123",
mediaSubSourceId: "fb_sub_456",
incentivized: true,
mediaAdsetName: "Summer Sale Adset",
mediaAdsetId: "adset_789",
mediaCreativeName: "Summer Sale Creative",
mediaCreativeId: "creative_101",
sub1: "campaign_source",
sub2: "ad_group",
sub3: "creative_type",
sub4: "placement",
sub5: "custom_param"
);
TyrSDKPlugin.Instance.LoginUser(userId, userInfo, mediaSourceInfo);Sending User Segments / User Info
4. Show Offerwall
Once the SDK is initialized and the user is logged in (if applicable), you can display the offerwall to the user. This typically involves calling a function provided by the Tyrads SDK, such as showOffers, passing in the context of your application. The offerwall is where users can engage with various offers, advertisements, or promotions provided by Tyrads, potentially earning rewards or incentives in the process.
TyrSDKPlugin.Instance.ShowOffers();4.1 Deeplinking Routes
The Tyrads SDK supports deeplinking to specific sections of the offerwall. When initializing or interacting with the SDK, you can specify a route to open a particular page. For campaign-specific routes, you'll need to provide the campaignID as well. Available routes and their usage:
TyradsDeepRoutes.Offers - opens the Campaigns Page
TyradsDeepRoutes.ActiveOffers - opens the Activated Campaigns Page
TyradsDeepRoutes.Offer - opens the Campaign Details Page (requires campaignID)
TyradsDeepRoutes.Support - opens the Campaign Tickets Page (requires campaignID)
//Use TyradsDeepRoutes class to avoid typos
TyrSDKPlugin.Instance.ShowOffers(TyradsDeepRoutes.Offers);
//Specify a route and campaignID
TyrSDKPlugin.Instance.ShowOffers(TyradsDeepRoutes.Offer, campaignId: 111);Last updated