Offer Codes (iOS Only)

This guide will help you as a company admin create and assign coupon codes for your affiliates within the Insert Affiliate platform.

Create the Codes within App Store Connect

To set up offer codes, you must follow the "Create Custom Codes" steps outlined in the Apple Developer Documentation.

If you have any questions about the process, please reach out to the Apple Developer Support team. If you are still unsure, reach out to your Insert Affiliate account manager for further assistance.

Due to our implementation, the custom codes will not be made visible to the users the affiliate send their link to, so you can set the codes to be as long as you like. We advise that you set the longest expiry date possible for the codes to ensure that they are valid for as long as possible.

Description of the image

iOS Setup

1. Install Insert Affiliate's SDK

To install the Insert Affiliate Swift SDK for iOS, follow the instructions on our GitHub repository.

Required Code Change

To enable Offer codes, we require a small code change to be made to your iOS app.

Open your App Delegate file within your iOS project and add the code below:

We advise you store and pass these values into your app in a secure way.

Swift

import InsertAffiliateSwift

class AppDelegate: UIResponder, UIApplicationDelegate {

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
    Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
      if let referringLink = params?["~referring_link"] as? String {
        InsertAffiliateSwift.fetchAndConditionallyOpenUrl(affiliateLink: referringLink, offerCodeUrlId: "{{ your_offer_code_url_id }}")

        // Other code required for Insert Affiliate...
      }
      return true
    }
  }
}

Update Insert Affiliate Platform Settings

Once you have created the codes within App Store Connect, you will need to add them to the Insert Affiliate platform. To do this, follow these steps:

  1. Log in to the Insert Affiliate platform.
  2. Click on the Settings tab.
  3. Under "Offer Codes", insert the codes you have created in App Store Connect.

Assign Codes to Affiliates

  1. Go to the Affiliates tab.
  2. Click on the affiliate you wish to assign the code to.
  3. In the "Offer Code" field, select the code you wish to assign to the affiliate.
  4. Click "Save Changes".

The affiliate will now be able to share their unique link with the code embedded. When a user clicks on the link, the code will be automatically applied and the offer appear when the app is opened via the affiliates link.