Integrate the Button SDK on

Integrate the Button SDK

This guide will walk you through how to add the Button SDK into your application. The SDK captures the user for attribution and allows Button to properly affiliate commissions and user rewards. In this guide, we will:

Enable mobile web Publishers

What are Universal Links?

Universal Links allow you to open your app to specific content or actions from an http-style URL, if your app is installed. This means that for any given web URL, it will open in your app if it's available, or on the website if not. It is the simplest way to support deep linking and is the method that both Google and Apple now recommend. To enable this, do the following:

  1. Configure the 'Associated Domains' entitlement in the 'Capabilities' tab on your Target
  2. Add your domain to the list (example

Setup post-install deep linking

To setup post-install deep linking, add the domain you use on the web (e.g. to the Button Dashboard. This is required so that Publishers can add your Button to their mobile website. This helps when post-install deep linking occurs, which is when a user clicks your Button in a Publisher mobile website and the user does not have your app installed. When this happens, Button will then route the user to the App Store or Google Play Store for them to download your app. When the user opens up your app after it is downloaded, the deep link is lost and your app does not know what your user was doing when it came in from Button. This results in the Publisher losing that commission if a transaction is made. To avoid this and allow Button to apply the appropriate commissions, when your application launches, we will look for a post-install deep link for this user when you call configureWithApplicationId:completion: in your didFinishLaunchingWithOptions method. If we find a match, we will provide you with the deep link in the completion handler. It is your responsibility to route your user to the content in your app represented by the deep link.

import Button

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool

  // Replace YOUR_BUTTON_APP_ID with your App ID from the Button Dashboard
  Button.shared().configure(withApplicationId: "<#YOUR_BUTTON_APP_ID#>") { error, url in
    // take your user to the content at `url`

  return true
@import Button

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  // Replace YOUR_BUTTON_APP_ID with your App ID from the Button Dashboard
  [[Button sharedButton] configureWithApplicationId:@"<#YOUR_BUTTON_APP_ID#>" completion:^(NSError *error, NSURL *url) {
    // take your user to the content at `url`

  return YES;

Setup mobile web affiliation

In addition to integrating the Button SDK into your iOS app, you must also include ButtonJS in your mobile website. ButtonJS is a Javascript library that captures users for attribution on your mobile website, allowing Button to properly affiliate commissions and user rewards. See how to set this up here.

Button Links

Button Links are a simple, free way to bring users from all channels directly into your app with tracking, attribution and post-install deep linking. After integrating, you can simply replace .com with

e.g. ->

Button Links are enhanced by:

  • Sending users who don't have your app to the app store
  • Maintaining the user's destination through install using post-install deep linking
  • Full reporting and attribution, with a Dashboard to dig in to the numbers

Deep Linking Support

In order to use Button Links, your app needs to support deep linking using Universal Links. Don't support it yet? Follow our simple guide to get up and running with your first deep links in just a few minutes, using our DeepLink Kit.

Configure Button Links

In order to start using Button Links you first need to set up your Button Links Domain. This is the base URL that you will use for links that you want to enhance.

Your Button Links Domain is a subdomain of which you can use interchangeably with that will always either open your app if installed, send the user to the App Store for post-install deep linking or forward them to on the relevant page.

In the Button Dashboard, navigate to "Merchant" > "Apps" & click on the App you want to configure a Button Links domain for. Once on the App details page, click on the "Add a Button Links Domain" button in the "Button Links Domains" section. Simply fill out the details in the popup modal to complete the configuration.

To create your Button Links domain, choose the subdomain of that you want to use for your app, specify the base web domain (the domain that you normally use on the web) and associate it with your app. You can do it here in the Dashboard.

See your first Link

Once you configure your domain, you can try your first Button Link. Get a Button Link either by using the Button Link Generator on the page or simply replace with in any of your usual links.

Open it in a browser on your mobile device and you'll see your Button Links landing page. We're part of the way there, but before we can open your app using Universal Links or take advantage of post-install deep linking and advanced analytics, you'll need to integrate with Button in your app.

Configuring your app

Next, to support Universal Links for the Button domain (to stop any Safari redirecting) you need to add the Button subdomain ( to the Associated Domains Capability. Switch Associated Domains on if it's not already and add your domain to the list of domains registered in the format

Web Links

Now, when you run your app and tap a Button Link, it should open in your app.

Next Steps

You now have all the features of the Button SDK integrated and are ready to begin reporting orders to Button.

Report Orders to Button

All orders must be affiliated through Button so we can properly reward commissions to Publishers who have your Button in their application.

View Guide