测试 Branch iOS / Android / Web SDK
iOS / Android
链接用户体验
- 建立应该具有深度链接的快速链接(与打开主屏幕相比)
- 通过电子邮件将链接发送给自己
- 不要将链接粘贴到浏览器栏中
- 确保电子邮件没有“包装”链接(即追踪或安全域)
- 点击来自测试设备(而非模拟器)的链接
- 确保测试的应用版本使用与链接相同的 API key(测试 vs. 实时)
- Click link in these scenarios
SDK 初始化
- Enable debug mode for Branch SDK by calling the
setDebug()/enableLogging()
before the SDK is initialized. You can find examples in the above videos, and in our iOS or Android documentation. - 启动您的应用,并在日志控制台(即 Logcat)中查看调试日志。
- 通过确保 SDK 向 v1/open 或 v1/install endpoint 发出了请求,验证 Branch SDK 是否已正确初始化:
- 关闭应用,并验证 SDK 是否向 v1/close endpoint 发送了请求。
- 重复执行步骤2-4,以确保在每次操作时都发送请求,而不仅仅是在您首次启动应用时发送。
- Create a Branch link through either of the available Branch methods, some of which are: Quick Links, API, or any of the SDK methods.
- Use the following methods for iOS or Android to test the link, and make sure that it is all set up. Make sure to verify that link data is passed into the application every time, and your application is able to parse the data correctly via
initSession()
callback.
SDK 自定义事件记录
Non-referred 事件:
- Trigger the custom event via SDK (iOS / Android)
- Verify that each event is sent to Branch by verifying the Logs (with debug/logging enabled, you should see a v1/event call) and Dashboard Liveview events.
- If you are a Data Feeds user, you should see this event attributed in a Custom Event export.
- If it is a commerce event (iOS / Android) - make sure all the commerce data is also passed to Branch through the same sources.
Referred 事件
- 点击链接
- Trigger the custom event via SDK (iOS / Android)
- If it is a commerce event iOS / Android) - make sure all the commerce data is also passed to Branch through the same sources
- 验证每个事件都已发送到
- SDK:验证日志(通过调用 setDebug()/enableLogging(),您应该看到一个 v1/event 调用)以及
- Data Feeds: You should see this event attributed with link ID in the last_attributed_touch_data_tilde_id data (Export API, CSVs, Webhooks)
- Dashboard Liveview events: You should see the event triggered and the link in the Session Referring Link URL
延迟深度连结
- 将测试设备连接到计算机
- 卸载设备上的所有应用版本(测试和生产)
- 点击设备中的 Branch Link
- 让链接重定向到 App Store,但不要下载该应用
- 通过 xcode 将应用构建到设备中| android studio
- 确保应用版本包含 Branch SDK 和与链接相同的 API key
- 必须在点击链接的2小时内发生(Branch 匹配窗口默认为2小时)
- 打开应用以初始化 Branch SDK,该 SDK 将浏览器<>设备对与最近的点击匹配
- 如果设备点击过 Branch Link,则一定会匹配;如果未点击,则 Branch 将使用指纹进行匹配
- 如果 Branch 发现浏览器<>设备对已经安装了应用,则 +is_first_session 参数值将为“ 0”
- 要在测试期间将 +is_first_session 设置为“ 1”,请在 SDK 中激活调试模式
Web SDK
SDK 初始化
- 确保您没有运行任何 Adblocker(Web SDK 受到阻止)
- 确保在网络调用中加载了 branch-latest.min.js
- 查找 app.link 请求:
- 确保响应为200 OK
- 确保 branch_key 参数中有正确的 Branch key
- Example: https://app.link/_r?sdk=web2.33.1&_t=446772116780734172&branch_key=key_live_hkDytPACtipny3N9XmnbZlapBDdj4WIL&callback=branch_callback__0
Journeys(网站向App引流解决方案)
- 确认 Web SDK 中使用的 API key 与应用内使用的 API key 一致
- 验证深度链接路由设置
- If not using
$canonical_url
, confirm keys accounted for via banner template, .setBranchViewData, or Metatags - 确认应用可以识别 app.link 备用域
- 激活广告横幅并验证筛选项
- 检查包含 Web SDK 的 URL,广告横幅应显示在何处
- 检查包含 Web SDK 的 URL,其中不应出现广告横幅
- 在这些情况下,使用会深度链接(即不是主屏幕)的广告横幅加载网页
- iOS-Safari(未安装应用)
- iOS-Safari(已安装应用-冷启动)
- iOS-Safari(已安装应用-热启动)
- iOS-Chrome(未安装应用)
- iOS-Chrome(已安装应用-冷启动)
- iOS-Chrome(已安装应用-热启动)
- Android-Chrome(未安装应用)
- Android-Chrome(已安装应用-冷启动)
- Android-Chrome(已安装应用-热启动)
最佳实践
- Test on actual devices, and utilize Test Mode to imitate fresh installs, otherwise - Branch will be able to identify that device previously had the application installed, and will not send the install event.
- When testing on multiple devices at the same time - it is best to use different links, and not identify with the same ID. Otherwise, Branch will consider both devices to be used by the same user. In that case - links clicked on one device will be able to pass data to another device.
We also recommend testing on different networks, or on one device at a time to prevent flaky behavior. - During testing, you may run into Error messages containing the following text, or its variation: “can't open the page because the address is invalid.” This is an indicator that you used to have your application installed, and used it recently. You then uninstalled the application and clicked on a Branch link.
This happens when our forced URI redirect mode tries to forcefully open the application via a URI scheme. When the application is not available on the device - it will result in the given error.
This scenario will almost never happen to regular users, as our research has shown, however it will greatly improve app opening through deep linking.
If you would rather be on a safe side - you may change the forcefulness of the mode at the top of your Link Settings page. We recommend keeping it at the intelligent mode setting.
视频演练
Updated over 2 years ago