# Initialization

Integrating TyrAds web is easy and can be done by just passing the url in the in-app-browser or iframe:

```
https://websdk.tyrads.com/?apiKey=YOUR_API_KEY&apiSecret=YOUR_API_SECRET&encKey=YOUR_ENCRYPTION_KEY&userID=CUSTOMER_USER_ID&platform=web&av=3&sdkVersion=3.0.0
```

Just replace the following values with your own.

* YOUR\_API\_KEY
* YOUR\_API\_SECRET
* YOUR\_ENCRYPTION\_KEY

encKey: This is the newly added parameter. It stands for "encryption key" and would be used for encrypting data transmitted from the iframe. If not provided data will be transmitted plain form.

* CUSTOMER\_USER\_ID

\
The sdkVersion parameter now operates under the following logic:\
If sdkVersion is NOT provided in the URL: The system will default to displaying v2.0.\
If sdkVersion IS provided and is 3.0.0 or greater: The system will display v3.0

**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:

* `campaigns` - opens the Campaigns Page
* `campaigns-activated` - opens the Activated Campaigns Page
* `campaign-details` - opens the Campaign Details Page (requires campaignID)
* `campaign-tickets` - opens the Campaign Tickets Page (requires campaignID)

```

// Note: CAMPAIGNS is the default route when no specific route is provided

https://websdk.tyrads.com/?apiKey=YOUR_API_KEY&apiSecret=YOUR_API_SECRET&userID=CUSTOMER_USER_ID&platform=web

// Explicitly specifying the Campaigns Page by appending `&route=campaigns` to the URL

https://websdk.tyrads.com/?apiKey=YOUR_API_KEY&apiSecret=YOUR_API_SECRET&userID=CUSTOMER_USER_ID&platform=web&route=campaigns

// Activated Campaigns Page by appending `&route=campaigns-activated` to the URL

https://websdk.tyrads.com/?apiKey=YOUR_API_KEY&apiSecret=YOUR_API_SECRET&userID=CUSTOMER_USER_ID&platform=web&route=campaigns-activated

// Campaign Details Page (requires campaignID) by appending `&route=campaign-details&campaignID=YOUR_CAMPAIGN_ID` to the URL

https://websdk.tyrads.com/?apiKey=YOUR_API_KEY&apiSecret=YOUR_API_SECRET&userID=CUSTOMER_USER_ID&platform=web&route=campaign-details&campaignID=YOUR_CAMPAIGN_ID

// Campaign Tickets Page (requires campaignID) by appending `&route=campaign-tickets&campaignID=YOUR_CAMPAIGN_ID` to the URL

https://websdk.tyrads.com/?apiKey=YOUR_API_KEY&apiSecret=YOUR_API_SECRET&userID=CUSTOMER_USER_ID&platform=web&route=campaign-tickets&campaignID=YOUR_CAMPAIGN_ID


```

If your website is using html, you can use the following steps to integrate TyrAds web:

* add an iframe to your page

```html
<iframe id="tyrads_iframe" src="" height="650" width="300"></iframe>
```

* provide the source URL dynamically to the iframe src attribute

```js
<script type="text/javascript" deffered>
        (function () {

                var frameElement = document.getElementById("tyrads_iframe");
                var apiKey = "YOUR API KEY"
                var apiSecret = "YOUR API SECRET"
                var userId = "1234567890"
                frameElement.src = "https://websdk.tyrads.com/?apiKey=" + apiKey + "&apiSecret=" + apiSecret + "&userID=" + userId + "&platform=web";

        })();  
</script>
```

### Localization

#### Introduction

Localization is a crucial feature that allows our application to support multiple languages, enhancing user experience across different regions. This documentation explains how to use the localization feature in our application, both through URL parameters and internal web application settings.

#### Localization via URL Parameters

**Overview**

To specify the language for our application using URL parameters, you can append the `lang` parameter to the URL. This method is useful for direct linking to language-specific pages.

**Supported Languages**

The following languages are supported:

* **English (en)**
* **Spanish (es)**
* **Indonesian (id)**
* **Korean (ko)**
* **Japanese (ja)**

**Usage Example**

To access the application in Korean, you would use the following URL:

```http
http://example.com/?apiKey=YOUR_API_KEY&apiSecret=YOUR_API_SECRET&userID=YOUR_USER_ID&newUser=false&platform=Android&hc=%23000F1E&mc=%232CB388&route=null&campaignID=null&sdk_version=1.1.11&av=3.0&lang=ko
```

#### Localization Inside the Web Application

**Overview**

In addition to using URL parameters, the web application itself can change the localization settings. This allows users to switch languages directly within the application.

**Supported Languages**

The same set of languages is supported as with the URL parameter method:

* **English (en)**
* **Spanish (es)**
* **Indonesian (id)**
* **Korean (ko)**
* **Japanese (ja)**

**Usage**

1. **Access the Localization Settings**: Navigate to the settings or preferences section of the web application.
2. **Select Language**: Choose your preferred language from the list of supported languages.
3. **Apply Changes**: Save your selection to update the application's language.

#### Best Practices

* **URL Encoding**: When using URL parameters, ensure that special characters are properly encoded to avoid errors.
* **Language Codes**: Use standard ISO language codes (e.g., `en` for English) for consistency and compatibility.
* **Testing**: Always test the application in each supported language to ensure proper rendering and functionality.

#### Troubleshooting

* **Unsupported Languages**: If a language is not supported, the application may default to a fallback language English (`en`).
*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sdk-doc.tyrads.com/web-iframe/initialization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
