> For the complete documentation index, see [llms.txt](https://help.impact.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/platform-features/tracking/set-up-tracking/troubleshooting-universal-links-in-app-to-app-tracking.md).

# 排查应用到应用跟踪中的通用链接问题

<a href="https://pxa.impact.com/student/activity/1117597?sid=0c0e3e5c-54c9-4435-9bee-ebcdccb7f292&#x26;sid_i=0?utm_source=app.impact.com&#x26;utm_medium=owned-platform&#x26;utm_content=tra-350&#x26;utm_campaign=help-center" class="button primary">参加 PXA 课程</a>

Universal Links 在操作系统（OS）级别进行验证，并且需要用户发起的操作，例如点击网页链接，才能打开移动应用。

#### 排查 Universal Links 问题

{% stepper %}
{% step %}

#### **确认来自合作伙伴应用的点击是用户发起的点击**

假设该链接不是普通的锚点标签，而是会实例化一个新的 **WebView** （请参见本页底部的说明。）在这种情况下，这不算作用户发起的导航，因此操作系统不会打开 Universal Link。这是最常见的情况。要解决此问题，您应考虑在 WebView（WKWebView、UIWebView 或 SFSafariViewController）中使用普通锚点链接，以便通过 Universal Link 启动应用。

其他非用户实例化点击的例子包括将 URL 直接复制粘贴到搜索栏中，或使用 JavaScript 导航到该链接，例如 `onload()` 或 `click()`.
{% endstep %}

{% step %}

#### **检查你要将用户发送到的页面是否支持 Universal Links**

在某些情况下，impact.com 依赖于在后续重定向中配置 Universal Links，通常是广告主域名。

* 例如，impact.com 的跟踪域名（`goto.advertiser.com`）会重定向到 `advertiser.com`。Universal Links 配置在 `advertiser.com` 域上。因此，务必确认你要将用户发送到的页面已启用 Universal Links。你可以通过检查广告主域上的 Apple 关联文件来确认。
* 在我们的示例中， `http://advertiser.com/.well-known/apple-app-site-association`，你会注意到 impact.com 跟踪域的关联文件默认包含所有子目录。

{% hint style="info" %}
**注意：** 尽管在使用 JavaScript 重定向时 Universal Links 不起作用，但 HTTP 3xx 重定向仍会保留对原始用户事件的引用。impact.com 在跟踪中使用 HTTP 3xx 重定向，因此当其他条件满足时，用户点击跟踪域后跳转的链接仍能成功启动广告主应用。
{% endhint %}

例如，下面的关联文件将允许以下 Universal Links： `advertiser.com/item/123` 但不允许以下链接： `advertiser.com` 或 `advertiser.com/section/furniture`.

```programlisting
{
   "applinks":{
      "apps":[
      ],
      "details":[
         {
            "appID":"A1AAA22BBB.com.advertiser.Advertiser",
            "paths":[
               "NOT /section/*",
               "/item/*"
            ]
         }
      ]
   }
} 
```

{% endstep %}

{% step %}

#### **请注意，最初打开的 WebView 也支持通过 Universal Links 进行重定向**

某些 WebView 会阻止 Universal Links，这会导致跟踪链接在 WebView 内部打开，而不是打开广告主应用。虽然这种情况不常见，但当 WebView 导航策略设置为 WKNavigationActionPolicyAllow + 2 时，就可能发生。这会导致 WebView 直接导航到该链接，而不会尝试使用 Universal Link。
{% endstep %}

{% step %}

#### **查看社交媒体政策**

某些社交媒体应用（如 Facebook）会阻止 Universal Links。如果是这种情况，使用 **移动应用中间页** 可能会有所帮助，我们建议联系你的 CSM 寻求帮助（或者 [联系支持团队](https://app.impact.com/support/portal.ihtml?createTicket=true)）。impact.com 正在积极探索改进来自社交媒体应用的深度链接和归因的方法。
{% endstep %}
{% endstepper %}

#### 来自 Apple 的进一步说明

如果你实例化一个 [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) , [WKWebView](https://developer.apple.com/documentation/webkit/wkwebview) ，或 [UIWebView](https://developer.apple.com/documentation/uikit/uiwebview) 对象来处理 Universal Link，iOS 会在 Safari 中打开你的网站，而不是打开你的应用。不过，如果用户在嵌入式 SFSafariViewController、WKWebView 或 UIWebView 对象内点击 Universal Link，iOS 会打开你的应用。

请参阅 Apple 的 [支持 Universal Links](https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html) 帮助文章了解更多信息。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/platform-features/tracking/set-up-tracking/troubleshooting-universal-links-in-app-to-app-tracking.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
