React Native SDK - 支持推荐人短链接

文档

创建短推荐人链接

注: 此功能在 SDK 3.1.8+ 版本中可用。

使用短链接可将冗长、充满参数的奇异链接转换为更短、更安全的链接,方便分享。

通常情况下,您需要动态创建短链接,以便应用程序的用户可以与朋友分享,邀请他们使用应用程序。

要创建短链接,您需要

  • 指向应用程序下载的奇异链接(请参阅奇异链接常见问题)。
  • 要动态添加到链接中的任何参数(选项列表请参阅跟踪链接参数)。
  • 推荐用户的姓名和 ID,如果您希望跟踪新应用的安装情况,并追溯到共享链接的用户。

使用createReferrerShortLink方法创建短链接,如下例所示。

Singular.createReferrerShortLink 方法

签名

Singular.createReferrerShortLink(singularLink, referrerName, referrerId, passthroughParams)

使用示例

javascript
Singular.createReferrerShortLink (
    "https://sample.sng.link/B4tbm/v8fp?_dl=https%3A%2F%2Fabc.com",
    "John Doe", // Referrer Name

    "aq239897", // Referrer ID

    {"channel": "sms"}, // Any parameters you want to add to the link

    (shortLinkURL,error) => {
      // Add your share logic here if shortLinkURL is not null. 

      // If there was an error, add logic to retry/abort/modify the 

      //  params passed to the function, based on the cause of the error.

    }
)