Testing
Every app has a test environment — an isolated view of installs, opens, and events that keeps QA traffic out of your live metrics. Use the Live / Test switch on the app overview page in the dashboard.
What is environment-scoped
| Data | Environment-scoped? |
|---|---|
| Installs, opens, events (incl. revenue) | Yes — tagged live or test |
| Links | No — shared |
| Clicks | No — shared |
| Devices | No — shared |
Links, clicks, and devices are shared deliberately: testing should exercise the real pipeline. A test install still resolves your real links and matches real clicks — the only difference is that the recorded install lands in the test environment.
Test keys
Test credentials are separate key pairs issued per app — create one in the dashboard under App → Settings → API keys → New test key. Test credentials use self-identifying prefixes (ak_test_… / sk_test_…).
Ship the test key in debug/internal builds and the live key in release builds:
await Attriv.init({
appKey: __DEV__ ? "ak_test_…" : "ak_…",
apiUrl: "https://api.getattriv.com",
});
Installs, opens, and custom events reported under a test key are tagged test and appear only in the test view. SDK-facing behavior is identical — attribution, deep links, and getAttribution() work the same under either key.
Testing installs and attribution
- Create a regular link in the dashboard (test views use live links).
- Click it on a device with a debug build (using the test key) or paste it into a notes app.
- Install/open the app — the install records under
testand shows up in the test view with itsmatchTypebadge.
To test again on the same device, uninstall and reinstall the app — the reinstall path re-runs attribution just like production.
Revenue events (RevenueCat)
RevenueCat sandbox purchases are routed automatically: any event with environment: "SANDBOX" is recorded in the test environment regardless of which key authenticated the webhook. Enable Sandbox webhooks in your RevenueCat project to have sandbox events delivered at all.
- Sandbox purchases (incl. accelerated sandbox renewals) land in the test view with their price — useful for verifying revenue attribution end to end.
- RevenueCat TEST events (sent from the RevenueCat dashboard when configuring the webhook) are recorded as
revenuecat.test— the quickest way to verify the delivery path. - Test-environment revenue is test money — it never counts toward live revenue.
app_user_id must match the identity your SDK reported via Attriv.identify() under the test key.TestFlight
TestFlight purchases are sandbox transactions, so store webhooks report them in the sandbox environment. TestFlight builds typically embed the same release binary — if you also want TestFlight installs to stay out of live stats, ship the test key in that build.
Stats API
All stats endpoints accept an env query parameter — live (default) or test:
curl "https://api.getattriv.com/api/apps/{appId}/stats/overview?env=test&days=30" \
-H "Authorization: Bearer <access_token>"
If you belong to more than one workspace, also pass -H "x-attriv-org: <workspace_id>" so the app resolves in the right one — with a single workspace the header is optional.
Key creation accepts it too — POST /api/apps/{appId}/keys?env=test issues a test key pair. DELETE /api/apps/{appId}/keys/{keyId} revokes a pair: SDK calls with its ak_… and webhook requests with its sk_… start failing immediately.