筛选项

网络问题排查

浏览器支持

  • Branch Web SDK 需要本地浏览器 Javascript,并且已经在所有具有 sessionStorage 功能的现代浏览器中进行了测试。使用 SDK 无需第三方库,因为它是100%原生 Javascript。

Chrome

Firefox

Safari

IE

9、10、11

Bower 或 Npm 兼容性

  • 使用 bower install branch-sdk or npm install branch-sdk

CommonJS 和 RequireJS 兼容性

  • 添加 require('branch') or define(['branch'], function(branch) { ... });

Branch 初始化选项

Key

类型

必要项

branch_match_id

The current user's browser-fingerprint-id. The value of this parameter should be the same as the value of ?branch_match_id (automatically appended by Branch after a link click). _Only necessary if ?_branch_match_id is lost due to multiple redirects in your flow.

string

N

branch_view_id

If you would like to test how Journeys render on your page before activating them, you can set the value of this parameter to the id of the view you are testing. Only necessary when testing a view related to a Journey.

string

N

no_journeys

When true, prevents Journeys from appearing on current page.

boolean

N

disable_entry_animation

When true, prevents a Journeys entry animation.

boolean

N

disable_exit_animation

When true, prevents a Journeys exit animation.

boolean

N

open_app

Whether to try to open the app passively through Journeys (as opposed to opening it upon user clicking); defaults to false.

boolean

N

nonce

A nonce value that will be included on any script or style tags Branch adds to your site. Used to allowlist these tags in your Content Security Policy.

string

N

测试读取深度链接

https://example.app.link/kJNbhZ1PrF?$fallback_url=https://example.com
https://example.app.link/kJNbhZ1PrF?$fallback_url=https://www.website.com/&_branch_match_id=418480444086051524
  • Read _branch_match_id from that $fallback_url website
branch.init('key_live_YOUR_KEY_GOES_HERE', function(err, data) {
  console.log(err, data);
});

Journey 不坚持导航

  • Navigate to Dashboard Journey Page
  • 选择 Journey -> Edit(编辑) -> Configure Views(配置视图) -> Banner(广告横幅) -> Page Placement(页面放置)
  • 广告横幅滚动= sticky
  • 新闻资讯 Save & Close
  • 在导航中添加以下 div
<div class="branch-journeys-top"></div>

创建调用性用语 (Call to Action)

<a href="#" onclick="branch.deepviewCta()">deep link</a>
<button onclick="branch.deepviewCta()">deep link</button>
var linkData = {
  campaign: String(Date.now())
};
var linkOptions = {
  make_new_link: false, // don't create a new deep link if one already exists (e.g. _branch_match_id is in the address bar)
  open_app: true  // will attempt to open the app if install (URI Scheme deep linking only - will not work with Safari)
};
branch.deepview(linkData, linkOptions, function(err, data) {
  console.log(err, data);
});

无访问控制错误

  • 确保 Branch key 在深度链接和网站内相同
XMLHttpRequest cannot load https://api2.branch.io/v1/open. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 400.

浏览器指纹 ID

  • 如果您需要访问用户的浏览器指纹 ID 来删除用户,请使用以下功能。
branch.getBrowserFingerprintId(function(err, data) { console.log(data); });

违反内容安全策略(Content Security Policy)

  • Generate a dynamic nonce value, and include that value as a script-src and style-src exception within your Content Security Policy
  • 将相同的值传递给 branch.init()
branch.init(YOUR_BRANCH_KEY, {'nonce': 'GENERATED_NONCE_VALUE' });

后续步骤推荐