使用自定义数据 branch.io 创建深度 link (react-native)
Create deep link with custom data branch.io (react-native)
我需要使用自定义数据创建深度 link,我想添加 userId 作为参数,我该怎么做?
我的想法是使用这样的东西,但我得到了一个错误“await is reserved word
”。
let linkProperties = {
feature: 'share',
channel: 'facebook',
userId: "125",
}
let controlParams = {
$desktop_url: 'http://desktop-url.com/monster/12345'
}
let {url} = await branchUniversalObject.generateShortUrl(linkProperties, controlParams)
return url
我找到了解决方案,可以通过使用这样的代码来实现
let branchUniversalObject = await branch.createBranchUniversalObject('canonicalIdentifier', {
title: 'Cool Content!',
contentDescription: 'Cool Content Description'}),
contentMetadata: {
customMetadata: {
userId: "125", // your userId field would be defined under customMetadata
}
}
})
async shareReferralLink () {
let linkProperties = {
feature: 'share',
channel: 'facebook',
userId: "125",
}
let controlParams = {
$desktop_url: 'http://desktop-url.com/monster/12345'
}
let {url} = await branchUniversalObject.generateShortUrl(linkProperties, controlParams)
console.log("URL ", url)
}
或者另一种解决方案是在 branch.io 仪表板中创建短 link,然后在 link 的添加中添加数据,只需添加 ?usedId=1234
,所以 link 将如下所示:https://test.app.link/home?userId=1234
看起来问题是 resolved.The 可以像您提到的那样将数据添加为查询参数。如有任何其他问题,请随时通过 integrations@branch.io 与我们联系!
我需要使用自定义数据创建深度 link,我想添加 userId 作为参数,我该怎么做?
我的想法是使用这样的东西,但我得到了一个错误“await is reserved word
”。
let linkProperties = {
feature: 'share',
channel: 'facebook',
userId: "125",
}
let controlParams = {
$desktop_url: 'http://desktop-url.com/monster/12345'
}
let {url} = await branchUniversalObject.generateShortUrl(linkProperties, controlParams)
return url
我找到了解决方案,可以通过使用这样的代码来实现
let branchUniversalObject = await branch.createBranchUniversalObject('canonicalIdentifier', {
title: 'Cool Content!',
contentDescription: 'Cool Content Description'}),
contentMetadata: {
customMetadata: {
userId: "125", // your userId field would be defined under customMetadata
}
}
})
async shareReferralLink () {
let linkProperties = {
feature: 'share',
channel: 'facebook',
userId: "125",
}
let controlParams = {
$desktop_url: 'http://desktop-url.com/monster/12345'
}
let {url} = await branchUniversalObject.generateShortUrl(linkProperties, controlParams)
console.log("URL ", url)
}
或者另一种解决方案是在 branch.io 仪表板中创建短 link,然后在 link 的添加中添加数据,只需添加 ?usedId=1234
,所以 link 将如下所示:https://test.app.link/home?userId=1234
看起来问题是 resolved.The 可以像您提到的那样将数据添加为查询参数。如有任何其他问题,请随时通过 integrations@branch.io 与我们联系!