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

# Import your revenue history into CrispStats

> When you connect a payment provider with a key, CrispStats imports the payments and refunds made before you connected, so revenue, MRR and All time cover your whole history.

A webhook only reports payments from the moment it is added. When you connect a payment provider with a key, CrispStats also reads the payments made before that and records them the same way it records new ones. Revenue, refunds, MRR and the charts then cover your history, not just the days since you connected. The import starts as soon as you connect.

## How far back each provider goes

| Provider | What is imported |
| - | - |
| [Stripe](https://docs.crispstats.com/revenue/stripe.md) | Every Checkout payment, subscription invoice, Payment Intent with a visitor id, and refund since your first |
| [Polar](https://docs.crispstats.com/revenue/polar.md) | Every paid order and refund |
| [Paddle](https://docs.crispstats.com/revenue/paddle.md) | Every completed transaction and approved adjustment of the products you selected |
| [Dodo Payments](https://docs.crispstats.com/revenue/dodo.md) | Every succeeded payment and refund |
| [Creem](https://docs.crispstats.com/revenue/creem.md) | Every transaction. Past one-time sales arrive without a visit, because Creem keeps no checkout details for them |
| [Whop](https://docs.crispstats.com/revenue/whop.md) | Every paid payment and refund of the company |
| [Razorpay](https://docs.crispstats.com/revenue/razorpay.md) | Every captured payment and processed refund |
| [Lemon Squeezy](https://docs.crispstats.com/revenue/lemon-squeezy.md) | Every order, subscription payment and refund of the chosen store |
| [Shopify](https://docs.crispstats.com/revenue/shopify.md) | Every order and refund with `read_all_orders`, otherwise the last 60 days |
| [RevenueCat](https://docs.crispstats.com/revenue/revenuecat.md) | Every purchase of every customer in the project, read customer by customer |
| [Superwall](https://docs.crispstats.com/revenue/superwall.md) | What Superwall's event log keeps. Superwall does not say how long that is; the row shows the oldest date reached |
| [App Store](https://docs.crispstats.com/revenue/app-store.md) | The last 365 days of daily reports, which is as long as Apple keeps them |
| [Shopify App Store](https://docs.crispstats.com/revenue/shopify-app-store.md) | Every earning of the app |

Each payment keeps its own currency and its amount in minor units. Payments in a currency other than your site's are listed in the payments table but not added to totals, as with new payments.

Imported payments are history: they do not appear in the live feed on Realtime and do not send sale notifications. Every imported payment is read from the provider's API with your key, so it is verified, and test payments keep their **Test** tag.

### Nothing is counted twice

Every past payment gets exactly the id it gets when it arrives by webhook or by a regular check: for example the invoice id of a Stripe subscription payment, the transaction or order id elsewhere, and the refund's own id for a refund. A payment that already arrived, or came in an earlier import, is recognised and skipped. You can run the import as often as you like.

A refund is stored only once its sale is stored and counted. A refund of a sale the import never read, or of a product you did not select, is never counted.

## From when

From your first payment, on every plan and in the trial, as far back as the provider lets CrispStats read. Payments are kept for as long as the site exists: your plan's [data retention](https://docs.crispstats.com/account/plans-and-limits.md#data-retention) applies to traffic (visits, events, sessions and errors), never to payments, and payments stay when a paid plan ends.

The import stops at the moment it starts. Anything after that arrives by webhook or by the regular check.

One exception: a key connection to [Creem](https://docs.crispstats.com/revenue/creem.md) or [RevenueCat](https://docs.crispstats.com/revenue/revenuecat.md) stores some payments under other ids than a webhook you added by hand. When it replaces such a connection, the import and the checks start just after the newest payment already stored, so no payment is read a second time under a new id. The payments from before stay as they were, and are not verified. The Revenue page's history line names that date.

## Attribution of past payments

Old payments are attributed with the same rules as new ones, and never to a source that was not recorded:

1. **A visitor id on the payment**, in the metadata, custom data, notes or cart attribute your checkout set. If CrispStats saw that visitor, the payment is tied to their first visit.
2. **The identified customer.** A user id in the metadata, the provider's customer id where it is your own user id, or an earlier attributed payment from the same customer email (compared by hash; the address is never stored).
3. **Otherwise: not attributed.** The payment counts in revenue, MRR and every total, and is left out of the channel and source breakdowns rather than filed under Direct.

Payments made before CrispStats was on your site have no visit to tie them to, so most of an older history is not attributed. That is expected.

## Follow the import

In **Settings**, **Integrations**, the provider's row shows the import's progress:

| Line | Meaning |
| - | - |
| Importing past payments: 340 so far, back to March 2025. | Running. It reads one page at a time and resumes on its own after an interruption. |
| Reading customers: 1,200 purchases found so far. | RevenueCat: it reads every customer of the project in turn. |
| Reading Apple's daily reports: 3 March 2026. | App Store: one report per day. |
| Imported 1,240 past payments since 3 January 2024. | Done. |
| A line naming a missing permission | Stopped. Payments imported before it stopped are kept. Add the permission and select **Import again**. |

If the provider asks CrispStats to slow down, the import waits and continues by itself.

The Revenue page shows a quiet line under the chart with the range your payments cover and whether the history is complete. Charts, totals and MRR for old dates fill in within a few minutes of each page being imported.

## Run it again

Select **Import again** on the provider's row. Use it after adding a missing permission, or after changing which products or apps count. Payments already recorded are skipped. For Paddle and the App Store, it first removes the stored sales of products or apps no longer selected, with their refunds.

Reconnecting with a new key starts the import over with that key. A test key imports test payments, which keep their **Test** tag.

> [!NOTE]
>
> A connection made earlier by pasting a webhook signing secret, without a key, cannot read past payments. Connect the provider again with a key to start the import.


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