> 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/advocate-program/manage-advocate-participants/custom-and-calculated-fields/tracking-windows-for-calculated-fields-explained.md).

# 计算字段跟踪窗口说明

{% hint style="info" %}
**注意**：请参阅我们的文章，了解 [计算字段](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/calculated-fields-explained.md) 是什么以及何时适用。如果您需要有关如何为计算字段设置跟踪窗口的帮助，请参阅 [设置计算字段](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/set-up-a-calculated-field.md).
{% endhint %}

跟踪窗口允许您向计算字段添加基于时间的元素。您可以为使用求和或计数计算的任何计算字段添加跟踪窗口。

如果您希望参与者定期累积某个值（例如购买金额），并根据该值给予奖励，那么在计算字段中使用跟踪窗口会很有用。事件数据仅会在您选择的窗口期间进行计算；随着时间推移、窗口更新，之前的数据将不再计入。

您可以使用字段中的值来设置计划规则，激励参与者朝着以下目标努力：

* **近期性**：鼓励不活跃的参与者重新活跃起来或再次购买。
* **频率**：激励最常与您的计划和服务互动的客户继续参与。
* **金额**：奖励达到指定购买金额门槛的高消费客户。

设置计算字段时，您可以选择以下两种跟踪窗口类型：

{% tabs %}
{% tab title="固定跟踪窗口" %}
固定窗口可用于跟踪某个值在一个日历日、周、月或年内的情况。窗口从时间段开始时启动，并在该时间段结束时滚动更新。开始和结束时间取决于 impact.com 帐户的时区设置。

使用固定窗口创建计算字段后，它会从字段创建时开始计数——不会等到下一个完整时间段开始，也不会追溯计算（默认情况下）当前时间段开始以来遗漏的任何值。

<details>

<summary>示例</summary>

假设您想设置一条计划规则，为每月消费超过指定金额的参与者发放特别奖励。为此，您需要创建一个计算字段，在 1 个月的固定窗口内对购买金额求和。完成设置后，购买事件将从每月第一天午夜开始计入，直至该月最后一天晚上 11:59。

<div data-with-frame="true"><figure><img src="https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-0e7df8d9fa2b2b8cc3f1b333ce601aacde2f0b6f%2Ffce9f5404d15d0c5692cb3e89ff28b1305dd4baf8572e51e71766b633cc75c09.png?alt=media" alt=""><figcaption></figcaption></figure></div>

</details>
{% endtab %}

{% tab title="滑动跟踪窗口" %}
滑动窗口可用于衡量自定义时间段（最长为 90 天、周、月或年）内的某个值。与固定窗口不同，滑动窗口不依赖固定的日历时间段——您可以将窗口设为 10 天、5 周、3 个月、2 年等。

每个时间段都包含一个独立的 **单位** 时间。每经过一个单位，并且我们收到符合条件的新事件时，计算字段就会更新。

| 示例时间段 | 时间单位                    | 字段将更新的时间…… |
| ----- | ----------------------- | ---------- |
| 10 天  | 1 天（凌晨 12:00 至晚上 11:59） | 每过一天       |
| 5 周   | 1 周（周日至周六）              | 每过一周       |
| 3 个月  | 1 个月（从月初到月末）            | 每过一个月      |
| 2 年   | 1 年（1 月 1 日至 12 月 31 日） | 每过一年       |

滑动窗口允许您为跟踪窗口中的每个单位设置求和或计数的最大值，例如，设置 90 天窗口中每天的上限，或 12 周窗口中每周的上限。此设置不会为整个时间段设定上限，而只会限制每个单位的最大值。

无论时间段如何，我们都将每个单位的开始时间视为凌晨 12:00（午夜），结束时间视为晚上 11:59。我们会根据 impact.com 帐户的时区设置确定这些时间。

<details>

<summary>示例</summary>

假设您希望参与者根据其在 90 天内的消费金额累积积分。每过一天并收到新的匹配事件数据后，计算字段值就会更新，以反映过去 90 天的消费金额。

<div data-with-frame="true"><figure><img src="https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-947333eb074b672e6904336b45f10753b2fc0bb9%2Ffc0d585ccace147e93200605e9af49924c8bb0ea43d5104d735aabdde9f87751.png?alt=media" alt=""><figcaption></figcaption></figure></div>

</details>
{% endtab %}
{% endtabs %}


---

# 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/advocate-program/manage-advocate-participants/custom-and-calculated-fields/tracking-windows-for-calculated-fields-explained.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.
