iOS SDK - Supporting Referrer Short Links

Creating Short Referrer Links

Note: This functionality is available in SDK version 11.0.8+.

Use the createReferrerShortLink method to generate a shortened share link for the User to share the app with friends. Define the referring user details in your app code when the link is created. This allows for tracking referrer attributions in reporting.

To create a short link:

  1. Build a Singular Custom Source Link with defined deep links, that leads to your app download (see the Singular Links FAQ). This link will be referred to as a base link in the code below.
  2. Any campaign override parameters to add to the link dynamically (see Tracking Link Parameters for the list of options).
  3. The Name and ID of the referring user, in order to track new app installs back to the user who shared the link.

Use the createReferrerShortLink method to generate the short link as in the example below.

createReferrerShortLink Method
Description Use the createReferrerShortLink method to generate a shortened share link for the User to share the app with friends.
Signature (void)createReferrerShortLink:(NSString *)baseLink referrerName:(NSString *)referrerName referrerId:(NSString *)referrerId passthroughParams:(NSDictionary *)passthroughParams completionHandler:(void(^)(NSString *, NSError *))completionHandler;
Usage Example
SwiftObjective-C
// 1. Define variables for the referrer short link

            
// Define your Singular tracking link to be used as a base link:

let referrerBaseLink = "https://yourdomain.sng.link/Csfge/aknl?_dl=myscheme%3A%2F%2Fmydeeplink/referrer&_smtype=3";
    
// Add your Referrer ID and Name

let referrerID = referrerIDField.text;
let referrerName = referrerNameField.text;
    
// Customize any Passthrough Parameters

let passthroughParams = ["channel": "sms"]
        
// 2. Call  ReferrerShortLink to get your shortlink to share on social media

Singular.createReferrerShortLink(referrerBaseLink, 
  referrerName: referrerName, 
  referrerId: referrerID, 
  passthroughParams: passthroughParams, 
  completionHandler: {(shortLink, error) in
    if error != nil {
      // Logic to retry/abort/modify the params passed to the function, 

      // based on the cause of the error

    }
    if (shortLink != nil || shortLink != "") {
      // Add your share logic here:

      //...
    }
})