> 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).

# 排查应用到应用跟踪中的 Universal Links 问题

<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** （请参见本页底部的说明。）在这种情况下，这不算作用户发起的导航，因此 OS 不会打开 Universal Link。这是最常见的场景。要解决此问题，建议考虑在 WebView（WKWebView、UIWebView 或 SFSafariViewController）中使用普通锚点链接来启动应用。

其他非用户实例化点击的示例包括：直接将 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
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=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
