> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.offerzy.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Add the offerwall to your app

> Open the hosted offerwall in an in-app browser or a WebView on Android and iOS.

In an app, open the same offerwall link you would use on the web, with the signed-in user's ID:

```text theme={null}
https://wall.offerzy.io/{placement_id}?user_id={USER_ID}
```

Create a separate placement for each platform, Android and iOS, so each one gets its own link and reports. See [Placements](/offerwall/placements).

## Recommended: an in-app browser

Chrome Custom Tabs on Android and `SFSafariViewController` on iOS take a few lines of code, and they open app store links from offers correctly, with no extra handling.

<CodeGroup>
  ```kotlin Android (Kotlin) theme={null}
  // Add the androidx.browser:browser library to your dependencies.
  import androidx.browser.customtabs.CustomTabsIntent

  fun openOfferwall(context: Context, placementId: String, userId: String) {
      val url = Uri.parse("https://wall.offerzy.io/$placementId")
          .buildUpon()
          .appendQueryParameter("user_id", userId)
          .build()
      CustomTabsIntent.Builder().build().launchUrl(context, url)
  }
  ```

  ```swift iOS (Swift) theme={null}
  import SafariServices

  func openOfferwall(from viewController: UIViewController, placementId: String, userId: String) {
      var components = URLComponents(string: "https://wall.offerzy.io/\(placementId)")!
      components.queryItems = [URLQueryItem(name: "user_id", value: userId)]
      viewController.present(SFSafariViewController(url: components.url!), animated: true)
  }
  ```
</CodeGroup>

<Note>
  React Native and Flutter apps can do the same with an in-app browser package, such as `expo-web-browser` or `url_launcher` with `LaunchMode.inAppBrowserView`.
</Note>

## Alternative: a WebView

If you show the offerwall inside your own screen, enable JavaScript and storage, keep offerwall pages in the WebView and send every other link (offers and app store pages) to the system, so installs open the store app.

<CodeGroup>
  ```kotlin Android (Kotlin) theme={null}
  webView.settings.javaScriptEnabled = true
  webView.settings.domStorageEnabled = true
  webView.webViewClient = object : WebViewClient() {
      override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean {
          if (request.url.host == "wall.offerzy.io") return false // stay in the WebView
          try {
              view.context.startActivity(Intent(Intent.ACTION_VIEW, request.url))
          } catch (e: ActivityNotFoundException) {
              // No app can open this link.
          }
          return true
      }
  }
  webView.loadUrl(offerwallUrl)
  ```

  ```swift iOS (Swift) theme={null}
  // Set webView.navigationDelegate and webView.uiDelegate to this object.
  func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction,
               decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
      guard let url = navigationAction.request.url, url.host != "wall.offerzy.io" else {
          return decisionHandler(.allow) // stay in the WebView
      }
      UIApplication.shared.open(url)
      decisionHandler(.cancel)
  }

  // Links that open a new window (target="_blank") arrive here instead.
  func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration,
               for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
      if let url = navigationAction.request.url { UIApplication.shared.open(url) }
      return nil
  }
  ```
</CodeGroup>

<Warning>
  Test an app install offer on a real device before you release: tapping it should open the Play Store or the App Store.
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.