Initialization
To get started with the @tyrads.com/tyrads-sdk package, you will need to:
Request an API key and API secret from the TyrAds team.
Initialize the SDK by calling
Tyrads.init()and passing in yourAPI key
API secret
encKey: It stands for "encryption key" and would be used for encrypting data transmitted from the SDK. If not provided, data will be transmitted plain form.
engagementId: *Optional* Unique identifier for tracking user engagement.
mediaSource: 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 as well as customize the earnings journey of different segments of users.
userInfo: Data on user information.
import Tyrads, { type TyradsMediaSourceInfo, type TyradsUserInfo } from '@tyrads.com/tyrads-sdk';
const mediaSource: TyradsMediaSourceInfo = {
mediaSourceName: "ExampleSource",
mediaCampaignName: "Spring Campaign",
mediaSourceId: "src123",
mediaSubSourceId: "subSrc456",
incentivized: true,
mediaAdsetName: "AdSet A",
mediaAdsetId: "adset789",
mediaCreativeName: "Creative X",
mediaCreativeId: "creative101",
sub1: "value1",
sub2: "value2",
sub3: "value3",
sub4: "value4",
sub5: "value5",
};
const userInfo: TyradsUserInfo = {
email: "[email protected]",
phoneNumber: "+1234567890",
userGroup: "premium_users",
}
await Tyrads.init(
"apiKey",
"apiSecret",
"encKey",
"engagementId",
mediaSource,
userInfo,
);
Login the user by calling
Tyrads.loginUser()and passing in the user's ID.Call
Tyrads.showOffers()to display the offers.
Launch Mode
Min SDK version required: v1.1.6
Works only for iOS
Tyrads SDK provides the ability to open the Offerwall in a webkit view that is embedded in the app to provide a seamless user experience. Also, it provides the ability to open the Offerwall in an external browser (Safari) if Apple's app store policy does not approve the in-app rewards system for the app.
Available launch modes:
launchMode: 3- opens the Offerwall in an external browser (Safari)launchMode: 2- opens the Offerwall in a webkit view that is embedded in the app
// Note: The launchMode parameter is optional, if not specified the default would be opening the Offerwall in an external browser (Safari)
Tyrads.showOffers({ launchMode: 3 });// provide launchMode: 2 to open the Offerwall in a webkit view that is embedded in the app
Last updated