# How the Revenue attributed is calculated

XFlow uses a **confidence-based attribution system** to determine whether — and how much — revenue should be credited to a back-in-stock notification.

:white\_check\_mark: This ensures attribution is fair, transparent, and realistic, especially when customers interact with multiple channels before purchasing.

{% hint style="info" %}

### What XFlow tries to answer

When a customer receives a back-in-stock notification and later places an order, XFlow evaluates:

1. Did the notification influence the purchase?
2. How strong was that influence?
3. How much revenue should be attributed?
   {% endhint %}

## Attribution calculation framework

<details>

<summary>1. Time-based attribution</summary>

**Attribution windows**

* **Standard window:** up to **7 days** after the email is **DELIVERED**
* **Extended window:** up to **14 days** if the email was **ENGAGED** (opened or clicked)

**Time decay logic**

The closer the purchase is to the notification, the higher the confidence:

| Time since notification  | Confidence level | Why it matters     |
| ------------------------ | ---------------- | ------------------ |
| 0–2 hours                | 100%             | Immediate response |
| 2–24 hours               | 90%              | Same-day purchase  |
| 1–3 days                 | 75%              | Strong connection  |
| 3–7 days                 | 50%              | Moderate influence |
| 7–14 days (engaged only) | 25%              | Weak but possible  |

</details>

<details>

<summary>2. Engagement-based attribution</summary>

**Base confidence by customer action:**

| Subscription status  | Base confidence |
| -------------------- | --------------- |
| Delivered → purchase | 60%             |
| Engaged → purchase   | 85%             |

Additional signals increase confidence:

* Email opened: +10 points
* Link clicked: +25 points
* Multiple opens: +5 points each (max 3)
* Product page visit: +15 points
* Add to cart: +20 points

</details>

<details>

<summary>3. Product matching logic</summary>

* **Exact match (highest confidence):**
  * Notification **product ID** = purchased product ID
  * Notification **variant ID** = purchased variant ID

→ 100% confidence

* **Indirect matches (reduced confidence):**

| Scenario                        | Confidence          |
| ------------------------------- | ------------------- |
| Same product, different variant | 80%                 |
| Same collection                 | 40%                 |
| Same vendor                     | 30%                 |
| Different product               | 0% (no attribution) |

</details>

<details>

<summary>4. Multiple notifications (multi-touch attribution)</summary>

If a customer receives **multiple notifications** before purchasing, XFlow distributes attribution based on:

* Recency
* Engagement level

> *Example:*&#x20;
>
> Customer gets 3 notifications, buys after the 2nd
>
> Notification 1: DELIVERED (3 days ago) → 50% base&#x20;
>
> Notification 2: ENGAGED (1 day ago) → 85% base
>
> Notification 3: DELIVERED (6 hours ago) → 90% base&#x20;
>
> → Attribution split based on recency and engagement Final Attribution:
>
> * Notification 1: 10% (oldest, low engagement)
> * Notification 2: 60% (engaged, recent)
> * Notification 3: 30% (recent, but not engaged)

</details>

***

## How XFlow decides the final revenue amount

Attribution outcomes:

* **High confidence (≥ 80%)**\
  → 100% of the product’s revenue is attributed
* **Medium confidence (50–79%)**\
  → Partial revenue is attributed
* **Low confidence (< 50%)**\
  → No revenue is attributed

> Discounts are applied **before** attribution.\
> Shipping, tax, and unrelated items are not attributed.


---

# Agent Instructions: 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://docs.foxecom.com/xflow-app/faqs-and-troubleshooting/how-the-revenue-attributed-is-calculated.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.
