文档
创建短推荐人链接
注:此功能在 SDK 11.0.8+ 版本中可用。
使用createReferrerShortLink方法生成简短的分享链接,供用户与朋友分享应用程序。创建链接时,在应用程序代码中定义推荐用户的详细信息。这样就可以在报告中跟踪推荐人的属性。
创建简短链接
- 使用已定义的深层链接创建一个奇异自定义源链接,该链接将引导您下载应用程序(请参阅奇异链接常见问题)。此链接将在下面的代码中称为基本链接。
- 动态添加到链接的任何活动覆盖参数(选项列表请参阅跟踪链接参数)。
- 推荐用户的姓名和 ID,以便跟踪新应用程序的安装情况,并返回到共享链接的用户。
使用createReferrerShortLink方法生成短链接,如下例所示。
createReferrerShortLink 方法 |
说明 |
使用createReferrerShortLink方法生成简短的分享链接,供用户与朋友分享应用程序。 |
签名 |
(void)createReferrerShortLink:(NSString *)baseLink referrerName:(NSString *)referrerName referrerId:(NSString *)referrerId passthroughParams:(NSDictionary *)passthroughParams completionHandler:(void(^)(NSString *, NSError *))completionHandler; |
使用示例 |
// 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:
//...
}
})
// 1. Define variables for the referrer short link
// Define your Singular tracking link to be used as a base link.
// Include any override parameters in the string as query string parameters.
NSString* referrerBaseLink = @"https://yourdomain.sng.link/Csfge/aknl?_dl=myscheme%3A%2F%2Fmydeeplink/referrer&_smtype=3";
// Add your Referrer ID and Name
NSString* referrerID = self.referrerIDField.text;
NSString* referrerName = self.referrerNameField.text;
// Customize any Passthrough Parameters
NSDictionary* passthroughParams = @{@"channel": @"sms"};
// 2. Call the ReferrerShortLink Method to get the shortlink to share on social media
[Singular createReferrerShortLink:referrerBaseLink
referrerName:referrerName
referrerId:referrerID
passthroughParams:passthroughParams
completionHandler:^(NSString *shortLink, NSError *error) {
if (error) {
// Logic to retry/abort/modify the params passed to the function,
// based on the cause of the error
}
if (shortLink) {
// Add your share logic here:
//...
}
}
];
|