Skip to main content
The Appeeky Analytics server is source-available. You can run it in your own Cloudflare account on Workers and D1 and point the SDK at it. Your installs, events and revenue then stay in your account and never pass through Appeeky.

How It Works

A self-hosted server is one Cloudflare Worker with one D1 database. It runs the same code as the hosted service, minus the features that need your Appeeky account.
  • Ingest. The SDK batches installs, sessions, screens and events and posts them with the app’s publishable key (apk_pub_…). A publishable key can only write events for its own app.
  • Revenue. RevenueCat and Superwall send purchase events to the worker. The worker matches each one to the install whose user id you passed to Appeeky.identify, so the sale gets the install’s source, campaign and link.
  • Smart links. /l/<slug> records the click and sends the visitor to the right store.
    • When the click carries an ad click id (ttclid, fbclid, gclid, gbraid, wbraid), the click keeps it, together with the visitor’s IP address and user agent.
    • On Android the click always reaches the install, through the Play install referrer.
    • On iOS it only reaches the install when the app is already installed and opens through the link. The App Store passes nothing to a fresh install, and the server does not fingerprint devices.
  • Scheduled work. A cron runs every 15 minutes. It retries Apple Search Ads lookups and, once a day per app, checks for anomalies.
  • Reading data. You can read your data in three ways: the worker’s dashboard at /, the REST API under /v1/apps/:id/... with your admin token, or the Appeeky desktop app connected to the server.

Hosted vs. Self-Hosted

Features that need your connected ad accounts or your Appeeky workspace only run on the hosted service. A self-hosted server can still send its data to your own systems through the conversion webhook.

Requirements

  • Node 20 or later
  • A Cloudflare account. The Workers free plan is enough to start.

Deploy

1

Create the database

Copy the database_id that d1 create prints into apps/worker/wrangler.toml.
2

Set secrets and deploy

The deploy prints your worker URL, for example https://appeeky-analytics.<you>.workers.dev. To use your own domain, add it under Workers → Settings → Domains & Routes.
3

Open the dashboard

Open https://<worker>/ and sign in with your ADMIN_TOKEN. That browser keeps the token in local storage until you sign out.
4

Add an app

The response has the app’s publishableKey (apk_pub_…). For a Play Store app, use "platform": "google" and the package name as storeAppId.
5

Point the SDK at your server

6

Connect RevenueCat

In RevenueCat, open Integrations → Webhooks and add a webhook:
  • URL: https://<worker>/v1/webhooks/revenuecat
  • Authorization header: your REVENUECAT_WEBHOOK_SECRET
  • Environment: production
In the app, call Appeeky.identify(await Purchases.getAppUserID()).

Updating

To update, pull the new version and deploy again. npm run deploy applies any new D1 migrations before it deploys the worker, so the schema and the code stay in step.

App Settings

Change an app with PATCH /v1/apps/:id and your admin token: POST /v1/apps/:id/rotate-key issues a new publishable key. DELETE /v1/apps/:id deletes the app and all of its data.

Superwall

If you sell through Superwall, instead of or alongside RevenueCat, send its events to the worker too.
  1. Create a secret:
  2. In Superwall, add a webhook endpoint at https://<worker>/v1/webhooks/superwall and send the secret as the Authorization header. If you can’t set a header, put it in the URL instead: https://<worker>/v1/webhooks/superwall?secret=<SUPERWALL_WEBHOOK_SECRET>.
  3. Pass the same user id to Superwall and to Appeeky.identify, so purchases match their install.
The worker records trials, purchases, trial conversions, renewals and refunds (negative prices), and ignores sandbox events. See Superwall for the event mapping.

Telegram Messages

The worker posts new sales (when notifySales is on) and anomaly alerts to one Telegram chat.
  1. Create a bot with @BotFather and copy its token.
  2. Send the bot a message, or add it to a group or channel.
  3. Find the chat id: open https://api.telegram.org/bot<token>/getUpdates and read message.chat.id.

Anomaly Alerts

Once a day per app, after 01:00 in the app’s time zone, the cron compares the previous day with the median of the 14 days before it. It checks installs, revenue, trials and install-to-paid conversion.
  • When it alerts: the change is 50% or more, and the numbers are large enough to mean something.
  • History needed: the app must have at least 7 days of history before it is checked.
  • Frequency: each metric alerts at most once per day.
Alerts go to your Telegram chat and to the conversion webhook. GET /v1/apps/:id/anomalies?range=30d lists them. See Anomaly alerts.

Conversion and Anomaly Webhook

To send revenue events to your own systems, for example to forward conversions to an ad platform yourself, set a webhook URL:
The worker posts every recorded sale and every anomaly alert. Sales are posted whether or not Telegram messages are on. Network errors, 429 and 5xx are retried up to three times, and ingest never waits for the webhook.
kind is one of trial_started, purchase, trial_converted, renewal or refund (with a negative valueUsd). Anomalies arrive as { "tenantId": "self", "type": "anomaly", "alert": { … } }, with the fields described in Anomaly alerts.
Create links with POST /v1/apps/:id/links. Two optional fields say where a link is used:
  • channel: tiktok_ads, meta_ads, google_ads, apple_ads, tiktok, instagram, facebook, youtube, x, reddit, creator, web, email or other
  • externalId: the ad campaign id for ad channels, or the post URL or id for organic channels
Link stats (GET /v1/apps/:id/links?range=30d) return clicks, installs and revenue per link. To keep the platform’s click id, use the smart link as the ad’s destination URL and let the platform append its click id parameter. See Smart links.

Users and Live Activity

See Users and live activity.

Use It From the Appeeky Desktop App

The desktop app can read a self-hosted server instead of the hosted service. Data goes straight from your server to the app, without passing through Appeeky.
  1. Open an app’s Attribution tab and go to Setup → Data source.
  2. Choose My server, enter the worker URL and your ADMIN_TOKEN, and select Connect. The app checks the server before it saves anything. The URL is stored on your Mac and the token in the macOS keychain.
  3. If the server has no app for this store id yet, select Add to my server, or link an app that already exists on the server.
These views then read your server: Overview, users and live activity, funnel and retention, LTV, smart links, SKAdNetwork and Setup. Ad signals, ROAS and organic posts need the hosted service, so they are hidden.

SKAdNetwork Postback Copies

iOS sends postback copies to the registrable domain named in the app’s Info.plist, at /.well-known/skadnetwork/report-attribution/ and /.well-known/appattribution/report-attribution/. iOS ignores subdomains, so use a domain you control at its root.
  1. Set the config plugin’s endpoint to your domain: ["@appeeky/analytics-expo", { "attributionEndpoint": "https://example.com" }].
  2. Serve those two paths from the worker on that domain, either with a Workers route (example.com/.well-known/skadnetwork/* and example.com/.well-known/appattribution/*) or with a rewrite on your site. Don’t redirect them, because iOS may not follow redirects.
  3. Set the app’s storeAppId to its Apple ID.

Limits

Ingest is limited to 600 batches per minute per publishable key ([[ratelimits]] in wrangler.toml). When the SDK gets 429, it keeps the batch and retries.

License

The server is released under FSL-1.1-MIT. You can use, modify and self-host it for any purpose except offering a competing commercial product. Each version becomes MIT two years after its release.