For the complete documentation index, see llms.txt. This page is also available as Markdown.

Initialization

Initialize After Media Source or MMP 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 revenue for your application.

1. Initialization

Call initialize once, as early as possible in your app's lifecycle — typically in application(_:didFinishLaunchingWithOptions:) (UIKit) or your App's init/.task (SwiftUI).

SDK Initialization best practices:

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.

Basic Initialization

import TyradsSDKIOS

Tyrads.instance.initialize(
    apiKey: "YOUR_API_KEY",
    apiSecret: "YOUR_API_SECRET"
)

Advanced Initialization (Personalized Rewards)

To maximize earnings and segment users, you can provide advanced user and media source information:


1.1 Initialization Parameter Reference

The initialize method accepts several parameters to configure the SDK and enhance user attribution.

Parameter
Type
Required
Description

apiKey

String

Yes

Your unique publisher identifier obtained from the Tyrads Dashboard.

apiSecret

String

Yes

Your publisher secret key used for secure server communication.

encryptionKey

String

No

Encryption Key: If provided, the SDK encrypts sensitive data during transmission. Recommended for high-security apps.

engagementId

String

No

Used to identify the engagement placement.

placementId

String

No

Used to differentiate between different coin placements within your app.

mediaSourceInfo

TyradsMediaSourceInfo

No

Attribution Data: Details about where the user came from (e.g. Facebook, Organic). Helps in tracking campaign performance.

userInfo

TyradsUserInfo

No

Metadata about the user (email, phone, user group) used for segmenting and personalizing offers.

config

TyradsConfig

No

SDK behavior settings, such as skipInitialPages to bypass the privacy/onboarding gate.


Detailed Objects

TyradsUserInfo

Used to provide context about the current user for better offer matching and demographic targeting.

  • email: User's email address.

  • phoneNumber: User's contact number. Replace the leading + with 00, e.g. 001234567890.

  • userGroup: A custom string to categorize the users. Provide either:

    • A string (e.g. "VIP", "High purchasing user").

    • A string JSON with multiple segmentation attributes. The object must be serialized to a string (e.g. "{\"promo_affinity_ratio\":0.42,\"dynamic_payer_segment\":\"NonPayer\",\"activity_segment\":\"Tier 3\",\"seniority_segment\":\"Tier 4\",\"rewarded_video_watcher_category\":\"High\"}" )

    • For more information, please refer to Sending User Segments / User Info

  • age: The user's age (e.g. 28).

  • gender: The user's gender represented as an integer (1 for Male, 2 for Female).

TyradsMediaSourceInfo

Essential for publishers who want to track the source of their users.

  • mediaSourceName: The platform name (e.g. "Facebook", "GoogleAdWords").

  • mediaCampaignName: The specific marketing campaign name.

  • mediaCreativeId: The ID of the specific ad creative the user interacted with.

  • sub1 through sub5: Custom slots for any additional tracking parameters you require. sub1, sub2, and sub5 are not returned on postback; sub3 and sub4 are.


2. User Authentication

Logging in the user is mandatory, and must be called after initialize. While providing a userID is optional, we strongly recommend using your own internal user ID to ensure progress is saved across device changes.


3. Showing the Offerwall

Once initialized and logged in, you can display the Offerwall.

Launch Mode

The Tyrads SDK provides two primary ways to display the Offerwall to your users. You can configure this globally during initialization or override it for specific calls.

TyradsLaunchMode Types

Mode
Description

.webview

(Default) Opens the Offerwall within an internal SDK-managed WebView inside your app.

.externalBrowser

Opens the Offerwall in the user's default system browser (Safari).


1. Global Configuration

Set the default launch behavior during SDK initialization:

2. Manual Override

Override the global setting when calling showOffers:

3. Dynamic Update

You can also change the global launch mode at any time after initialization:


The Tyrads SDK supports deeplinking to specific sections of the offerwall. When calling showOffers, you can specify a route to open a particular page. For campaign-specific routes, you'll also need to provide a campaignID.

See Deeplinking Routes for the full reference.


4. Premium Offers Widget

The Premium Offers widget is a standalone SwiftUI view that displays a preview of top offers. It is highly flexible and can be embedded anywhere in your UI.

See Premium Offers for widget styles and details.


5. Localization

You can change the SDK language dynamically at runtime. This choice is persisted across app sessions.

See Localization for supported language codes and notes.


6. Push Notifications (APNs)

Tyrads delivers push notifications through APNs using your app's own APNs credentials, so enable the Push Notifications capability and provide your APNs key details to Tyrads before going live.

The SDK never requests push permission itself — your app owns that decision, same as it would for any of its own push notification needs. Forward APNs lifecycle events to the SDK from your AppDelegate.

See Push Notifications for the full setup.


7. Callbacks

Register callbacks to monitor user actions within the SDK:

data is [String: Any] with campaign info.


8. Logout

Clears the stored session and resets login state. Call loginUser again to re-authenticate.


9. Manual Tracking

The SDK tracks core events (open, close, campaign actions) automatically. Use manual tracking for custom integration points:

Last updated