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.

LoginData loginData = new LoginData(userId: "userId"); //userID is optional
_ = await TyrSDKPlugin.Instance.LoginUserAsync(loginData);
circle-exclamation

To determine when initialization has completed, you can await the login operation and read the relevant data from the returned LoginResult:

LoginData loginData = new LoginData(userId: "userId");
LoginResult result = await TyrSDKPlugin.Instance.LoginUserAsync(loginData);

if (result.IsSuccessful)
{
   //do anything what you want after successful init...
}

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

circle-exclamation

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.

Sending Media Source Data

Sending User Segments / User Info

3.2 User Age & Gender Requirement

Before users can participate in reward activities, the SDK requires their age and gender to comply with partner requirements and properly configure available campaigns. If this information has not been provided, the SDK will automatically display a User Information page when the user opens any SDK screen that requires reward eligibility. After the data is submitted, it is stored and the page will not appear again unless the SDK state is reset.

Providing Age & Gender via API

If your application already collects age and gender, you can provide this information directly to the SDK. In this case, the User Information page will not be shown, ensuring a smoother user experience without additional prompts.

Providing user information programmatically is recommended when the application already manages user profiles or collects demographic data during onboarding.

3.3 Initialization & Authentication State

After the SDK completes its startup flow, it is important to clearly understand what “initialization” means in this context.

Although internally the SDK performs an initialization request, from a product and API perspective this step is effectively a user authentication (login) process. Once this flow completes successfully, the SDK is fully ready for use.

To allow developers to reliably verify this state, the SDK exposes a dedicated property that indicates whether the initialization/authentication process has finished successfully.

circle-info

The SDK exposes an Init(...) method, but its purpose is often misunderstood is sometimes misunderstood and union with IsInitialized.

Init(...) method does not initialize the SDK. Instead, this method is responsible for configuring the SDK with the required parameters that will later be used during the authentication phase (in LoginUserAsync(...) method).

Key Notes

  • IsInitialized reflects both:

    • Successful SDK setup

    • Successful user authentication

  • A true value guarantees that:

    • All required backend requests are completed

    • The SDK is in a valid, ready-to-use state

  • A false value means:

    • Initialization/authentication is still in progress, or

    • The process has failed

Last updated