> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crispstats.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> CrispStats is a hosted, privacy-first web analytics product. It has no self-hosted edition, no session replay, no heatmaps, no A/B testing, no mobile SDKs and no data import except a site's history from a Plausible export (Settings, Import and export).
> The script global is crispstats(...), site keys start with cs_pk_ and secret API keys start with cs_sk_. The script is served from https://in.crispstats.com/d.js and the REST API lives at https://crispstats.com/api/v1.
> There is no npm package to install. Integrations copy the script tag, the queue stub, crispstats.d.ts and proxy code from these docs or from Settings, Tracking code in the dashboard. A first-party proxy forwards one path of the site to https://in.crispstats.com/p/ and forwards only content-type, user-agent, accept-language, referer, origin, if-none-match and x-forwarded-for, never cookies.

# Connect App Store sales to CrispStats

> Connect App Store Connect with a team key that has Sales access, your Issuer ID, Key ID and vendor number: CrispStats reads Apple's daily sales reports for the apps you choose.

Connect the App Store with a team key from App Store Connect that can read sales reports. CrispStats reads Apple's daily Sales Summary reports for the apps you choose: paid downloads, in-app purchases, new subscriptions, renewals and refunds, from the last 365 days and every day after.

| | |
| - | - |
| You provide | The team key's `.p8` file, the Issuer ID, the Key ID and your vendor number, then choose the apps that count |
| New payments | The day after the sale, once Apple publishes its report: about 32 hours for a sale just after midnight Pacific |
| History | The last 365 days |
| Test mode | None: Apple's sales reports hold only real sales |
| Linked to a visit | No. Report sales cannot be linked to a visit |

## What is recorded

Each day's report has one row per product, country, price and currency. CrispStats adds up the rows of each product and currency for the day and stores one payment for each:

| Report row | Recorded as |
| - | - |
| A paid app download | `one_time` |
| An in-app purchase or non-renewing subscription | `one_time` |
| An auto-renewable subscription, marked new | `subscription_new` |
| An auto-renewable subscription, marked renewal | `subscription_renewal` |
| Negative units and a negative customer price | `refund` |

The amount is the customer price, tax included, in the customer's currency. Free downloads, trials, updates and restored purchases carry no money and are skipped. Every row is read from Apple with your key, so each payment is verified.

Some things Apple's reports do not say, and CrispStats does not guess:

* **The time of a sale.** App Store reports give the day of a sale, not the time. Each payment is dated noon Pacific time on its report day.
* **Which sale a refund reverses.** A refund counts only when a sale of the same item in the same currency was counted in the months before it.
* **Partial refunds.** Partial refunds Apple reports without an amount are not counted.

> [!NOTE]
>
> Apple's help page lists the report's columns, including whether a subscription row is new or a renewal, but not the exact words in that column. CrispStats reads the report by column name and counts a subscription row as new only when that column starts with "New"; any other subscription row is counted as a renewal. Apple counts resubscribing as a renewal too.

## Connect the App Store

You need the Admin or Account Holder role in App Store Connect to create a team key.

**1. Open the App Store panel**

In CrispStats, open the site's **Settings**, then **Integrations**. Select **Connect a payment provider** and choose **App Store**.

**2. Create a team key**

Select **Open App Store Connect**. It opens **Users and Access**, **Integrations**, **App Store Connect API**. Then:

1. Choose **Team Keys**, then **Generate API Key**. You need the Admin or Account Holder role.
2. Name it CrispStats and under **Access** choose **Sales**.
3. Download the `.p8` file and copy the **Issuer ID** and **Key ID**. Apple lets you download the file once.

**3. Choose the .p8 file**

Under **Your .p8 key**, choose the file you downloaded. It is read in your browser and sent once, then stored encrypted and never shown again. When the file has Apple's name, `AuthKey_` and the Key ID, the **Key ID** field fills in for you.

**4. Enter the Issuer ID, Key ID and vendor number**

Paste the **Issuer ID** (the long code above the list of team keys) and the **Key ID**. For **Vendor number**, select **Open Payments and Financial Reports** and copy the number next to your legal entity.

**5. Find your apps**

Select **Find my apps**. CrispStats signs a short-lived token with your key, downloads Apple's latest daily sales report and lists the apps in it under **Apps that count**, all ticked. Untick apps that belong to another site. An app appears here after its first sale.

**6. Connect**

Select **Connect App Store**. The import of the last 365 days starts, and the row shows "Reading Apple's daily reports:" and the day it has reached.

| Message | What to do |
| - | - |
| Apple did not accept this key. Check the Issuer ID and Key ID match the .p8 file. | Copy both again from the team keys list. |
| This key cannot read sales reports. Create a new team key with Sales access. | A key's access cannot be changed: generate a new one. |
| No sales reports found for vendor number … | Check the number in **Payments and Financial Reports**. A new account gets its first report the day after its first sale. |
| Sales reports need a team key, not an individual key. | Generate a key under **Team Keys**. |

> [!NOTE]
>
> Apple's role list names the role **Sales**; the help card asks for it under **Access**. The exact wording of Apple's Access menu and the direct links to App Store Connect pages were not confirmed with a real account. If a link does not open the right page, follow the menu path given above.

## What the key can do

A team key with **Sales** access reads Sales and Trends. It cannot change apps, prices or users, and CrispStats never moves money. Apple applies a team key to every app in the account and does not let its access be narrowed to one app, so CrispStats keeps only the apps you ticked and drops every other row. To change the apps later, choose **Change apps** on the row; the change applies to payments recorded from then on. Choose **Import again** to apply it to past payments too: CrispStats removes the stored sales of apps no longer selected, with their refunds, then imports again.

CrispStats does not ask for **Finance**: it would also open your financial reports, which are not needed.

## How fresh the numbers are

Apple publishes each day's report the next morning, generally by 8 a.m. Pacific time. CrispStats asks for it every 4 hours until it arrives, so a day's sales appear within a few hours of Apple publishing them, and a sale made just after midnight Pacific appears about 32 hours later. When Apple publishes a report late, it is read on the next check after that. The row says "Updated from Apple's report for" the latest day, "The next report comes tomorrow morning, Pacific time."

## Past payments

Apple keeps daily reports for one year, so the import reads the last 365 days. Older sales cannot be read day by day. Apple does not change a daily report once it is published, so a day read twice is stored once. See [revenue history](https://docs.crispstats.com/revenue/history.md).

## Test mode

Sales reports contain only production sales. Sandbox and TestFlight purchases never appear in them, so nothing is test.

## Link sales to visits

App Store report sales cannot be linked to a visit: Apple's reports say what sold, not who bought it. They count in revenue, MRR and every total, and are left out of the source and campaign breakdowns.

## Disconnect

Select **Disconnect** on the App Store row. CrispStats stops reading reports and destroys the saved key. Payments already recorded stay. CrispStats created nothing in App Store Connect. To stop the key working, revoke it under **Team Keys** in App Store Connect.

## Next steps

> [card] [RevenueCat](https://docs.crispstats.com/revenue/revenuecat.md)
>
> Purchases as they happen, linked to signed-in users.

> [card] [How attribution works](https://docs.crispstats.com/revenue/overview.md)
>
> What counts in totals and what shows in breakdowns.

> [card] [Revenue history](https://docs.crispstats.com/revenue/history.md)
>
> What the import reads and how it avoids counting twice.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.