This is the full developer documentation for Pulsark # Overview > What Pulsark is, how it fits together, and where to start. Pulsark is a privacy-first analytics platform for **Android apps and in-app-advertising (IAA) games**, including apps distributed outside Google Play. It is built API-first and AI-native: everything you can see, your AI assistant can query too — through a REST API or a read-only [MCP server](/docs/mcp/). Early access Pulsark is in early access. Accounts are opened by hand — [request access](/#access) and we will create your organization and send your first platform key. ## How it fits together [Section titled “How it fits together”](#how-it-fits-together) ```plaintext Your app ──(Pulsark SDK, HTTPS)──► collect.pulsark.org ──► Pulsark (Singapore) │ You / your dashboards ◄── api.pulsark.org (REST) ◄───┤ Claude, Cursor, agents ◄── mcp.pulsark.org (MCP) ◄───┘ ``` | Piece | What it does | | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Android SDK** (`org.pulsark:analytics`) | \~70 KB Kotlin library. Sessions, foreground time and screens are tracked automatically; you add custom events and ad revenue. Never blocks the main thread, survives offline periods and process kills. | | **Collect API** | `POST https://collect.pulsark.org/v1/batch`, used by the SDK. Identified by your public `app_id`. | | **REST API** | Manage projects, apps and keys; query [metrics](/docs/metrics/). Authenticated with a secret platform key (`dak_…`). [OpenAPI](/openapi.json). | | **MCP server** | `https://mcp.pulsark.org/mcp`. Lets AI assistants list your apps and query metrics with the same definitions and permissions as the API. | ## Principles [Section titled “Principles”](#principles) * **No device identifiers.** No GAID, Android ID, IMEI or MAC. The user unit is an *installation*. See [Privacy & data](/docs/privacy/). * **No Google Play dependency.** Works in APKs distributed through your own site, app stores or partners. * **One set of metric definitions.** The dashboard, the API and your AI assistant all read the same [metric catalog](/docs/metrics/) — nobody invents their own “DAU”. * **Data you can trust.** Every event has an idempotency key; duplicates from retries are removed before metrics are computed. ## Start here [Section titled “Start here”](#start-here) 1. [Quickstart](/docs/quickstart/) — add the SDK and see your first events (10 minutes). 2. [Integrate with AI](/docs/ai-integration/) — let Claude Code, Cursor or Copilot do the integration for you. 3. [Connect the MCP server](/docs/mcp/) — ask your assistant “how did D1 retention change last week?”. ## Status [Section titled “Status”](#status) | Area | Status | | --------------------------------- | ----------------------------------------------- | | Android SDK (Kotlin / Java) | Available — 0.1.0 | | Unity plugin | Planned | | REST API, MCP (read-only) | Available | | Web console, self-service sign-up | Planned — accounts are created on request today | | Data region | Singapore | # Quickstart > Add the Pulsark Android SDK to your app and see your first events. You need an `app_id` (public, goes into your APK) and, to read data, a platform key (`dak_…`, secret, never put it in an app). Both come with your [early-access account](/#access). You can also create more apps with the [REST API](/docs/api/#apps). ## 1. Add the repository and dependency [Section titled “1. Add the repository and dependency”](#1-add-the-repository-and-dependency) settings.gradle.kts ```kotlin dependencyResolutionManagement { repositories { google() mavenCentral() maven("https://pulsark.org/maven/") } } ``` app/build.gradle.kts ```kotlin dependencies { implementation("org.pulsark:analytics:0.1.0") } ``` Requirements: `minSdk` 21+. The SDK adds the `INTERNET` and `ACCESS_NETWORK_STATE` permissions. Dependencies: OkHttp, AndroidX WorkManager and Lifecycle. ## 2. Initialize in `Application.onCreate` [Section titled “2. Initialize in Application.onCreate”](#2-initialize-in-applicationoncreate) MyApp.kt ```kotlin import org.pulsark.analytics.Profile import org.pulsark.analytics.Pulsark import org.pulsark.analytics.PulsarkConfig class MyApp : Application() { override fun onCreate() { super.onCreate() Pulsark.init(this, appId = "app_xxxxxxxxxxxx", config = PulsarkConfig(profile = Profile.GAME)) } } ``` MyApp.java ```java Pulsark.init(this, "app_xxxxxxxxxxxx", new PulsarkConfig()); ``` `init` takes < 5 ms and does all I/O on a background thread. Calls from secondary processes (for example an ad SDK’s process) are ignored automatically. ## 3. Record consent [Section titled “3. Record consent”](#3-record-consent) Until you call `setConsent`, only essential events are collected (`first_open`, `session_start`, `app_foreground`/`app_background`, `ad_impression`). After the user agrees: ```kotlin Pulsark.setConsent(ConsentState.GRANTED) ``` See [Privacy & data](/docs/privacy/) for what each state means. ## 4. Track something [Section titled “4. Track something”](#4-track-something) ```kotlin Pulsark.track("level_end", mapOf("level_id" to "3", "result" to "win", "duration_ms" to 41250)) ``` Sessions, foreground time and screens (`page_view`) are tracked for you. For ad revenue, see [Ad revenue](/docs/ad-revenue/). ## 5. Check it works [Section titled “5. Check it works”](#5-check-it-works) * Set `PulsarkConfig(debug = true)` and watch Logcat with the tag `Pulsark`. * Call `Pulsark.flush()` to upload immediately instead of waiting for the next batch. * Metrics are aggregated hourly. Query today’s DAU: ```bash curl -H "Authorization: Bearer $PULSARK_KEY" \ "https://api.pulsark.org/api/v1/metrics/dau?app_id=app_xxxxxxxxxxxx" ``` Or just ask your AI assistant after [connecting MCP](/docs/mcp/). ## Next [Section titled “Next”](#next) * [SDK reference](/docs/android/) — every method and option. * [Events](/docs/events/) — naming rules and limits. * [Integrate with AI](/docs/ai-integration/) — a ready-made prompt that does steps 1–4 for you. # Integrate with AI > Let Claude Code, Cursor, Copilot or any coding agent integrate Pulsark for you — and query your data afterwards. Pulsark’s docs are written to be read by machines as well as people: | Resource | URL | Use it for | | ----------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | | `llms.txt` | [/llms.txt](/llms.txt) | Index of the docs for LLMs | | `llms-full.txt` | [/llms-full.txt](/llms-full.txt) | All docs in one plain-text file | | Markdown per page | add `index.md` to any docs URL, e.g. [/docs/quickstart/index.md](/docs/quickstart/index.md) | Feeding one page to an agent | | OpenAPI 3.1 | [/openapi.json](/openapi.json) | Generating API clients, tool definitions | | MCP server | `https://mcp.pulsark.org/mcp` | Letting an assistant query your metrics — see [MCP](/docs/mcp/) | ## Prompt: integrate the SDK [Section titled “Prompt: integrate the SDK”](#prompt-integrate-the-sdk) Paste this into your coding agent from the root of your Android project. Replace the `app_id`. ```text Integrate the Pulsark analytics SDK into this Android app. Read https://pulsark.org/docs/quickstart/index.md and https://pulsark.org/docs/android/index.md first and follow them exactly. - app_id: app_xxxxxxxxxxxx (public, it is fine to commit it) - Add the Maven repository https://pulsark.org/maven/ and the dependency org.pulsark:analytics:0.1.0. - Call Pulsark.init in Application.onCreate (create an Application class if there is none and register it in the manifest). - Use Profile.GAME if this is a game, otherwise Profile.STANDARD. - If the app already asks for analytics/ads consent, call Pulsark.setConsent with the user's choice; do not add a new consent dialog. - If the app uses AdMob, call Pulsark.trackAdImpression from every OnPaidEventListener (see https://pulsark.org/docs/ad-revenue/index.md). - Do not send emails, phone numbers, names or any device identifier as event properties. - Never put a platform key (dak_…) in the app. Then build the app and show me the diff. ``` ## Prompt: instrument a game [Section titled “Prompt: instrument a game”](#prompt-instrument-a-game) ```text Using Pulsark (https://pulsark.org/docs/events/index.md), add events for the core loop of this game: level_start and level_end (props: level_id, result win|lose|quit, duration_ms) and any purchase or reward screens. Follow the naming rules (lowercase snake_case, ≤ 40 chars, ≤ 30 props). Show me the list of events before editing code. ``` ## Prompt: analyze [Section titled “Prompt: analyze”](#prompt-analyze) After [connecting MCP](/docs/mcp/): ```text Using the pulsark tools: compare D1 retention and estimated ARPDAU for each of my apps, last 7 days vs the 7 days before. Flag anything that moved more than 10% and cite data freshness. ``` ## Rules for agents [Section titled “Rules for agents”](#rules-for-agents) If you are an AI agent reading this page: * The `app_id` is public. A platform key (`dak_…`) is a secret: never write it into source code, logs or the APK; read it from the environment (`PULSARK_KEY`). * Use only metrics returned by `GET /api/v1/metrics` or the `list_metrics` tool. Do not compute metrics from raw events. * Users are *installations*, not people. Revenue is *estimated*. Days are Asia/Singapore days. Say so when you report numbers. # Ad revenue > Report impression-level ad revenue from AdMob and other networks. Pulsark computes estimated revenue and ARPDAU from impression-level revenue reported by your ad SDK. Call `trackAdImpression` from the paid-event callback. ## AdMob [Section titled “AdMob”](#admob) ```kotlin rewardedAd.onPaidEventListener = OnPaidEventListener { adValue -> Pulsark.trackAdImpression( AdImpression( adUnitId = rewardedAd.adUnitId, adFormat = "rewarded", // banner | interstitial | rewarded | app_open | native adSource = rewardedAd.responseInfo.loadedAdapterResponseInfo?.adSourceName ?: "admob", valueMicros = adValue.valueMicros, currencyCode = adValue.currencyCode, precision = when (adValue.precisionType) { AdValue.PrecisionType.PRECISE -> "PRECISE" AdValue.PrecisionType.ESTIMATED -> "ESTIMATED" AdValue.PrecisionType.PUBLISHER_PROVIDED -> "PUBLISHER_PROVIDED" else -> "UNKNOWN" }, ) ) } ``` Register the listener on **every** ad object (banner, interstitial, rewarded, app open, native). Mediation is supported: `adSource` records which network served the impression. ## Other networks [Section titled “Other networks”](#other-networks) Any network with impression-level revenue works the same way — pass the value in micros (1 USD = 1,000,000) and the ISO 4217 currency code. ## What you get [Section titled “What you get”](#what-you-get) | Metric | Definition | | ------------------------------------------------- | ------------------------------ | | [`ad_impressions`](/docs/metrics/#ad_impressions) | De-duplicated paid impressions | | [`est_ad_revenue`](/docs/metrics/#est_ad_revenue) | Sum of reported revenue, USD | | [`est_arpdau`](/docs/metrics/#est_arpdau) | Estimated revenue ÷ DAU | Estimated, not financial Client-reported revenue is an estimate for day-to-day decisions. Your ad network’s reports are authoritative for finance. Today only USD-denominated impressions are included in revenue metrics. # Android SDK reference > Every public method and configuration option of org.pulsark:analytics. Package `org.pulsark.analytics`. Every method is safe to call from any thread, never throws and never blocks the caller (except `getInstallationId`, see below). Java callers can use the same API — all methods are `@JvmStatic`. ## `Pulsark` [Section titled “Pulsark”](#pulsark) | Method | Description | | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | `init(context, appId, config = PulsarkConfig())` | Call once in `Application.onCreate`. Ignored in secondary processes and on repeated calls. | | `track(eventName, properties = emptyMap())` | Record a custom event. See [Events](/docs/events/) for naming rules and limits. | | `trackAdImpression(AdImpression)` | Record a paid ad impression. See [Ad revenue](/docs/ad-revenue/). | | `setConsent(ConsentState)` | `GRANTED`, `DENIED` or `UNKNOWN` (default). Persisted across launches. | | `setAccountUserId(userId: String?)` | Attach your own account ID after login; pass `null` on logout. The installation ID does not change. | | `optOut(enabled: Boolean)` | `true` stops collection and clears the local queue. | | `flush()` | Upload queued events now. | | `getInstallationId(): String` | The installation ID, e.g. for support or deletion requests. May wait up to 1 s while the SDK initializes — do not call it repeatedly on the main thread. | ## `PulsarkConfig` [Section titled “PulsarkConfig”](#pulsarkconfig) | Option | Default | Description | | ---------------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------- | | `endpoint` | `https://collect.pulsark.org` | Collection endpoint. Change only for testing. | | `profile` | `STANDARD` | `LITE`, `STANDARD` or `GAME` — see below. | | `channel` | `"unknown"` | Distribution channel of this build (e.g. per product flavor). Appears as `build_channel`. | | `debug` | `false` | Log to Logcat with tag `Pulsark`. | | `batchSize` | `30` | Upload when this many events are queued. | | `foregroundUploadIntervalSec` | `30` | Periodic upload while the app is in the foreground. | | `sessionTimeoutSec` | `30` | Background time after which returning starts a new session. | | `maxQueueEvents` / `maxQueueBytes` | `10000` / 10 MB | Local queue limits. When full, low-priority events are dropped first. | | `maxEventAgeDays` | `7` | Events older than this are dropped instead of uploaded. | ### Profiles [Section titled “Profiles”](#profiles) | Profile | For | Automatic events | | ---------- | ----------------- | ----------------------------------------------------------------- | | `LITE` | Minimal utilities | `first_open`, `session_start`, `app_foreground`, `app_background` | | `STANDARD` | Most apps | LITE + `page_view` (each Activity) | | `GAME` | IAA games | Same as STANDARD; use `trackAdImpression` and level events | ## Reliability [Section titled “Reliability”](#reliability) * Events are written to a local SQLite queue before upload and deleted only after the server confirms they are durably stored. * Network errors, timeouts and 5xx responses are retried with exponential backoff; the queue survives app restarts and force-stops. Uploads also run through WorkManager when the app is in the background. * Each event carries a unique `event_id` generated once and reused on every retry, so the server can discard duplicates. * Event time is corrected on the server using a monotonic clock, so users changing the device clock does not distort your data. ## Sessions [Section titled “Sessions”](#sessions) A session starts when the app comes to the foreground and ends when it has been in the background for longer than `sessionTimeoutSec`. Rotations, permission dialogs and short app switches do not start new sessions. If the process is killed while in the background and the user returns within the timeout, the session continues. ## Multiple processes and ad SDKs [Section titled “Multiple processes and ad SDKs”](#multiple-processes-and-ad-sdks) Some ad SDKs start their own process, which runs `Application.onCreate` again. Pulsark detects this and only initializes in the main process, so you do not need to guard the call. # REST API > Authentication, endpoints and examples for the Pulsark management and metrics API. Base URL: `https://api.pulsark.org`. Machine-readable description: [OpenAPI 3.1](/openapi.json). ## Authentication [Section titled “Authentication”](#authentication) Every request needs a platform key: ```http Authorization: Bearer dak_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` | | `app_id` | Platform key `dak_…` | | ------- | ------------------------- | -------------------------------------------------- | | Used by | The SDK | Your servers, scripts, AI assistants | | Secret? | No — it ships in your APK | **Yes** — shown once, stored only as a hash | | Scope | One app | An organization, optionally limited to one project | Keys carry scopes; give each key the least it needs. An AI assistant only needs `metrics:read`. | Scope | Allows | | -------------- | ---------------------------------------------------------- | | `metrics:read` | Query metrics, list metric definitions, use the MCP server | | `apps:read` | List projects and apps | | `apps:write` | Create projects and apps, rename or disable apps | | `keys:write` | List, create and revoke keys | Store keys in an environment variable such as `PULSARK_KEY`. Revoke a leaked key immediately with `DELETE /api/v1/keys/{id}`. ## Resources [Section titled “Resources”](#resources) ```plaintext Organization └─ Project a data boundary, e.g. "Puzzle games" └─ App one APK / package, identified by app_id ``` A key can only see apps in its organization (or its project). Asking for an app you cannot see returns `404`. ## Metrics [Section titled “Metrics”](#metrics) ### List metrics [Section titled “List metrics”](#list-metrics) ```bash curl -H "Authorization: Bearer $PULSARK_KEY" https://api.pulsark.org/api/v1/metrics ``` Returns name, title, unit, notes and allowed dimensions for every metric in the [catalog](/docs/metrics/). ### Query a metric [Section titled “Query a metric”](#query-a-metric) `GET /api/v1/metrics/{name}` | Parameter | Default | Description | | ------------ | ---------------- | ------------------------------------------------------------------ | | `app_id` | all visible apps | Comma-separated app IDs | | `from`, `to` | last 30 days | `YYYY-MM-DD`, Singapore statistical days, inclusive. Max 400 days. | | `group_by` | — | Up to 2 dimensions, comma-separated | | `filter` | — | `dimension:value1,value2`; repeat for several dimensions | ```bash curl -H "Authorization: Bearer $PULSARK_KEY" \ "https://api.pulsark.org/api/v1/metrics/est_arpdau?from=2026-11-01&to=2026-11-30&group_by=country&filter=country:ID,IN,BR,VN" ``` ```json { "metric": { "name": "est_arpdau", "title": "预估 ARPDAU", "unit": "USD", "notes": ["…"], "dimensions": ["app_id", "country", "app_version", "build_channel"] }, "from": "2026-11-01", "to": "2026-11-30", "group_by": ["country"], "rows": [ { "date": "2026-11-01", "country": "ID", "value": 0.0123 } ], "data_freshness": "2026-12-01 03:00:12", "timezone": "Asia/Singapore" } ``` `data_freshness` is the UTC time of the most recent aggregation in the range; an empty string means nothing has been aggregated yet. ## Apps [Section titled “Apps”](#apps) | Method | Path | Scope | | | ------- | ----------------------- | ------------ | ------------------------------------------------------- | | `GET` | `/api/v1/projects` | `apps:read` | List projects | | `POST` | `/api/v1/projects` | `apps:write` | `{"name": "…"}` | | `GET` | `/api/v1/apps` | `apps:read` | List apps | | `POST` | `/api/v1/apps` | `apps:write` | Register an app, returns its `app_id` | | `PATCH` | `/api/v1/apps/{app_id}` | `apps:write` | `{"name": "…"}` or `{"status": "disabled" \| "active"}` | ```bash curl -X POST -H "Authorization: Bearer $PULSARK_KEY" -H "Content-Type: application/json" \ -d '{"project_id": "prj_xxxxxxxxxxxx", "name": "Bubble Pop", "package_name": "com.example.bubblepop", "profile": "GAME"}' \ https://api.pulsark.org/api/v1/apps ``` A disabled app’s events are rejected within a minute. App IDs are never reused. ## Keys [Section titled “Keys”](#keys) | Method | Path | Scope | | | -------- | ------------------- | ------------ | --------------------------------------------------------------------------------------------------------- | | `GET` | `/api/v1/keys` | `keys:write` | List keys (prefix, scopes, last used — never the key itself) | | `POST` | `/api/v1/keys` | `keys:write` | `{"name": "claude", "scopes": ["metrics:read"], "project_id": "…"}` — the key is in the response **once** | | `DELETE` | `/api/v1/keys/{id}` | `keys:write` | Revoke immediately | A key can only grant scopes it has itself. ## Errors [Section titled “Errors”](#errors) Errors return JSON `{"error": "…"}` with a human-readable message (currently in Chinese for some endpoints; the status code is the contract). | Status | Meaning | | ------ | ------------------------------------------ | | 400 | Invalid parameter — the message says which | | 401 | Missing, invalid or revoked key | | 403 | The key lacks the required scope | | 404 | Not found, or not visible to this key | | 502 | Temporary query failure — retry | Every metrics query and every change to apps or keys is recorded in your organization’s audit log. # Events > Automatic events, custom event naming rules, property limits and priorities. ## Automatic events [Section titled “Automatic events”](#automatic-events) | Event | When | Properties | | ---------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `first_open` | First launch of this installation | — | | `session_start` | A new session begins | `is_first_session` | | `app_foreground` | App enters the foreground | — | | `app_background` | App leaves the foreground | `fg_duration_ms` | | `page_view` | An Activity is shown (`STANDARD`, `GAME`) | `page` (Activity class name) | | `ad_impression` | You call `trackAdImpression` | see [Ad revenue](/docs/ad-revenue/) | | `sdk_health` | At session start, only if something was dropped or retried | `dropped_overflow`, `dropped_expired`, `dropped_invalid`, `rejected_server`, `retries`, `queue_size` | ## Custom events [Section titled “Custom events”](#custom-events) ```kotlin Pulsark.track("level_end", mapOf("level_id" to "3", "result" to "win", "duration_ms" to 41250)) ``` | Rule | Limit | | -------------------- | ------------------------------------------------------------------------------------------------------------------- | | Event name | `^[a-z][a-z0-9_]{1,39}$` — lowercase snake_case, 2–40 chars. Prefer `verb_object`. Invalid names are dropped. | | Property key | `^[a-z][a-z0-9_]{0,39}$` | | Properties per event | 30 (extra keys are dropped) | | Property values | `String` (≤ 256 chars), integer, floating point (finite), `Boolean`. Other types and `null` are dropped. | | Sensitive keys | Keys containing `email`, `phone`, `password`, `passwd`, `token`, `imei`, `android_id` or `gaid` are always dropped. | Dropped events and properties are counted in `sdk_health`, so you can see integration mistakes without crashing the app. ### Suggested events for games [Section titled “Suggested events for games”](#suggested-events-for-games) | Event | Properties | | ------------------------ | ------------------------------------------------------------- | | `level_start` | `level_id` | | `level_end` | `level_id`, `result` (`win` / `lose` / `quit`), `duration_ms` | | `ad_request`, `ad_click` | `ad_unit_id`, `ad_format` | | `ad_load_fail` | `ad_unit_id`, `error_code` | ## Priorities and consent [Section titled “Priorities and consent”](#priorities-and-consent) Essential events — `first_open`, `session_start`, `app_foreground`, `app_background`, `ad_impression`, `sdk_health` — are collected even while consent is `UNKNOWN` and are kept first when the local queue is full. Everything else (`page_view`, custom events) is collected only after `setConsent(GRANTED)`. Nothing is collected after `DENIED` or `optOut(true)`. ## Context sent with every batch [Section titled “Context sent with every batch”](#context-sent-with-every-batch) App version and build, `build_channel`, SDK version, installation ID, your account user ID (if set), OS version and API level, device brand and model, language, time zone offset, network type (wifi / cellular) and consent state. The server adds the receive time, the country (from the request’s IP, which is not stored) and the collection region. # MCP server > Connect Claude, Cursor, VS Code and other MCP clients to your Pulsark metrics. Pulsark runs a remote [Model Context Protocol](https://modelcontextprotocol.io) server, so an AI assistant can look at your numbers directly — with the same metric definitions, tenant isolation and audit log as the REST API. All tools are **read-only**. | | | | --------- | ------------------------------------------------------------------ | | URL | `https://mcp.pulsark.org/mcp` | | Transport | Streamable HTTP (stateless, JSON responses) | | Auth | `Authorization: Bearer dak_…` — a platform key with `metrics:read` | Create a dedicated key for each assistant with only `metrics:read`, optionally limited to one project: ```bash curl -X POST -H "Authorization: Bearer $PULSARK_ADMIN_KEY" -H "Content-Type: application/json" \ -d '{"name": "claude-code", "scopes": ["metrics:read"]}' https://api.pulsark.org/api/v1/keys ``` ## Connect [Section titled “Connect”](#connect) ### Claude Code [Section titled “Claude Code”](#claude-code) ```bash claude mcp add --transport http pulsark https://mcp.pulsark.org/mcp \ --header "Authorization: Bearer $PULSARK_KEY" ``` ### Cursor [Section titled “Cursor”](#cursor) \~/.cursor/mcp.json ```json { "mcpServers": { "pulsark": { "url": "https://mcp.pulsark.org/mcp", "headers": { "Authorization": "Bearer ${env:PULSARK_KEY}" } } } } ``` ### VS Code (GitHub Copilot) [Section titled “VS Code (GitHub Copilot)”](#vs-code-github-copilot) .vscode/mcp.json ```json { "inputs": [{ "type": "promptString", "id": "pulsark-key", "description": "Pulsark key (metrics:read)", "password": true }], "servers": { "pulsark": { "type": "http", "url": "https://mcp.pulsark.org/mcp", "headers": { "Authorization": "Bearer ${input:pulsark-key}" } } } } ``` ### Claude Desktop and other clients without custom headers [Section titled “Claude Desktop and other clients without custom headers”](#claude-desktop-and-other-clients-without-custom-headers) Use the [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) bridge: claude_desktop_config.json ```json { "mcpServers": { "pulsark": { "command": "npx", "args": ["-y", "mcp-remote", "https://mcp.pulsark.org/mcp", "--header", "Authorization:${PULSARK_AUTH}"], "env": { "PULSARK_AUTH": "Bearer dak_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } } } } ``` OAuth sign-in (so you can add Pulsark as a connector without handling keys) is planned. ## Tools [Section titled “Tools”](#tools) | Tool | Arguments | Returns | | ----------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | `list_apps` | — | Apps this key can see: `app_id`, name, package, profile, status | | `list_metrics` | — | The [metric catalog](/docs/metrics/) with units, caveats, dimensions and `definition_url` | | `query_metric` | `metric`, `app_ids?`, `from?`, `to?`, `group_by?`, `filters?` | Daily rows, `data_freshness`, `timezone`, `definition_url` | | `compare_periods` | `metric`, `from`, `to`, `app_ids?`, `previous_from?`, `previous_to?` | Mean daily value of both periods, `change_pct`, both series | Every result carries the query range, `data_freshness` and a link to the metric definition, so an assistant can cite where a number came from. The server also sends instructions telling the model that users are installations, days are Singapore days and revenue is estimated. ## Try it [Section titled “Try it”](#try-it) > Which of my apps had the biggest drop in D1 retention last week compared with the week before? > Show estimated ARPDAU by country for the last 14 days and explain what’s driving the change. > Is today’s data complete yet? ## Test with curl [Section titled “Test with curl”](#test-with-curl) ```bash curl -s https://mcp.pulsark.org/mcp \ -H "Authorization: Bearer $PULSARK_KEY" -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"query_metric","arguments":{"metric":"dau"}}}' ``` # Metrics > The single catalog of metric definitions used by the API, the MCP server and every report. Every number Pulsark shows comes from this catalog. The API (`GET /api/v1/metrics`) and the MCP tool `list_metrics` return the same list, so people and AI assistants always use the same definitions. ## Conventions [Section titled “Conventions”](#conventions) | Convention | Meaning | | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | User unit | An **installation**: one install of one app on one device. Reinstalling, clearing app data, work profiles and app clones create new installations. Two phones = two installations. | | Across apps | Totals across apps are **sums**, not de-duplicated people. | | Statistical day | Calendar day in **Asia/Singapore (UTC+8)**. All timestamps are stored in UTC. | | Active | An installation with at least one `session_start` or `app_foreground` that day. Background work and SDK events do not count. | | De-duplication | Every metric is computed after removing duplicate events (same `event_id`). | | Event time | Corrected on the server using the device’s monotonic clock; the device wall clock is not trusted. | | Freshness | Today and yesterday are re-aggregated every hour; the previous 3 days are re-aggregated daily to include late (offline) events. Every API/MCP response includes `data_freshness`. | ## Users and activity [Section titled “Users and activity”](#users-and-activity) ### dau [Section titled “dau”](#dau) **DAU** (installations) — installations active on the day. ### new_users [Section titled “new_users”](#new_users) **New users** (installations) — installations seen for the first time on the day. This is the first time Pulsark observed the installation, not necessarily the install date. ### wau [Section titled “wau”](#wau) **WAU** (installations) — installations active in the 7 statistical days ending on the day (rolling). ### mau [Section titled “mau”](#mau) **MAU** (installations) — installations active in the 30 statistical days ending on the day (rolling). ### retention_d1 [Section titled “retention_d1”](#retention_d1) **D1 retention** (ratio) — of the installations first seen on day D0, the share active on D0+1. The date of each row is the cohort day D0. ### retention_d3 [Section titled “retention_d3”](#retention_d3) **D3 retention** — as above, active on D0+3. ### retention_d7 [Section titled “retention_d7”](#retention_d7) **D7 retention** — active on D0+7. ### retention_d14 [Section titled “retention_d14”](#retention_d14) **D14 retention** — active on D0+14. ### retention_d30 [Section titled “retention_d30”](#retention_d30) **D30 retention** — active on D0+30. Retention for a cohort appears only after day D0+N has fully ended (e.g. yesterday’s D1 retention appears tomorrow). Retention is recomputed daily at 02:00 Singapore time. ## Sessions [Section titled “Sessions”](#sessions) ### sessions [Section titled “sessions”](#sessions-1) **Sessions** — a session starts when the app comes to the foreground and a new one starts after more than 30 s in the background. Short switches (rotation, permission dialogs) do not start a new session. ### sessions_per_dau [Section titled “sessions_per_dau”](#sessions_per_dau) **Sessions per DAU** — sessions ÷ DAU. ### duration_per_dau [Section titled “duration_per_dau”](#duration_per_dau) **Time per DAU** (seconds) — total foreground time ÷ DAU. Foreground time is reported when the app goes to the background, so today’s value is incomplete until users leave the app. ## Ad monetization [Section titled “Ad monetization”](#ad-monetization) ### ad_impressions [Section titled “ad_impressions”](#ad_impressions) **Ad impressions** — de-duplicated paid impressions reported with `trackAdImpression`. USD-denominated only. ### est_ad_revenue [Section titled “est_ad_revenue”](#est_ad_revenue) **Estimated ad revenue** (USD) — sum of impression-level revenue (`valueMicros` ÷ 10⁶). An operational estimate; ad network reports are authoritative. ### est_arpdau [Section titled “est_arpdau”](#est_arpdau) **Estimated ARPDAU** (USD) — estimated ad revenue ÷ DAU. ## Dimensions [Section titled “Dimensions”](#dimensions) | Metrics | Group by / filter | | ------------------------------------------ | --------------------------------------------------- | | DAU, new users, sessions, time, ad metrics | `app_id`, `country`, `app_version`, `build_channel` | | WAU, MAU | `app_id` | | Retention | `app_id`, `country`, `build_channel` | `country` is an ISO 3166-1 alpha-2 code derived from the request’s IP address at collection time (the IP itself is not stored). # Privacy & data > What the SDK collects, what it never collects, consent, deletion and where data is stored. ## What we never collect [Section titled “What we never collect”](#what-we-never-collect) * Advertising ID (GAID), Android ID, IMEI, MAC address, serial numbers or any other device identifier * Names, emails, phone numbers — the SDK drops properties whose keys look like personal data * IP addresses — used once at collection time to derive the country, then discarded * Anything that would let us link one person across different apps ## What the SDK collects [Section titled “What the SDK collects”](#what-the-sdk-collects) | Data | Why | | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | | Installation ID — a random ID generated on first launch, stored in the app’s private storage, reset on reinstall or clearing data | Count users without device identifiers | | Events you track and the automatic events listed in [Events](/docs/events/) | Analytics | | App version, SDK version, OS version, device brand and model, language, time zone offset, network type | Segmentation and debugging | | Your account user ID, only if you call `setAccountUserId` | Linking a logged-in user’s installations, under your control | | Ad impression revenue, only if you call `trackAdImpression` | Monetization metrics | Installation IDs are per app: the same phone has a different ID in each of your apps, and backups do not carry it to another device. ## Consent [Section titled “Consent”](#consent) | State | Collected | | -------------------------- | ------------------------------------------------------------------------------------- | | `UNKNOWN` (default) | Essential events only: `first_open`, sessions, foreground/background, `ad_impression` | | `GRANTED` | Everything you track | | `DENIED` or `optOut(true)` | Nothing; the local queue is cleared | You decide how consent is obtained in your app. Make sure your privacy policy describes Pulsark as an analytics processor. ## Deletion [Section titled “Deletion”](#deletion) Users can find their installation ID through your app (`Pulsark.getInstallationId()`), and you can ask us to delete all data for that installation. A self-service deletion API is planned. ## Where data lives [Section titled “Where data lives”](#where-data-lives) Data is collected and stored in **Singapore**. Traffic is encrypted in transit (TLS) and served through Cloudflare. Databases are on a private network and are never exposed to the internet. Raw events are kept for 90 days; aggregated metrics are kept for the life of your account. ## Security [Section titled “Security”](#security) * Platform keys are stored only as SHA-256 hashes and shown once. * Every metrics query, app change and key change is written to an audit log. * The `app_id` in your APK is public by design: it can only *send* events, never read data.