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

# 排查 App 间跟踪中的 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）中使用普通的锚点链接，以便通过 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。如果是这种情况，使用 **Mobile App Interstitial** 可能会有帮助，我们建议您联系您的 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:

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

The question should be specific, self-contained, and written in natural language.
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.
