Track your app with one SDK
Open Analytics → App activity → Set up tracking. Choose your app and environment, then save the write-only key.
Download SDK 0.3.0 · Browser, React Native, Swift and Android source clients
npm install ./appspansion-sdk-0.3.0.tgz
import { createBrowserTracker } from '@appspansion/sdk/browser';
const app = createBrowserTracker({
apiOrigin: 'https://YOUR_API_ORIGIN',
publishableKey: 'YOUR_EVENT_KEY',
enabled: analyticsConsentGranted,
});
await app.track('onboarding_completed');The SDK saves events, manages sessions and retries failed deliveries. Browser campaign links are captured automatically. Use the included platform adapters for mobile lifecycle and storage. The package README covers native setup, consent, identity, payment verification and web2app handoffs.
To connect events to revenue, authenticate the customer on your backend, issue their short-lived customer session, then call app.identify(session). Keep workspace API credentials on your backend. Call app.reset() before switching accounts.
Campaign links and Play referrals are client-reported. Unmatched journeys stay unattributed. iOS store installs do not automatically preserve deep-link parameters; use a known signed-in customer or an explicit app-open link.
1. Create an API token
Open Workspace → Settings → Agent access. Name the token, choose read-only or write access, select its apps and set an expiry. Copy it once into your agent host’s secret settings. Never commit it or put it in a prompt.
2. Connect with MCP
Configure your MCP host to launch this command from the repository root:
pnpm --filter @factory/backend exec tsx src/apps/appspansion/mcp-server.ts
Supply these values through the host’s environment or secret manager:
APPSPANSION_API_TOKEN— the token you just createdAPPSPANSION_WORKSPACE_ID— shown under Agent accessAPPSPANSION_API_URL— optional; defaults to the local API on port 3411
The adapter uses stdio against a local API. For the hosted service, point a remote MCP client at https://appspansion.com/gateway/mcp: it registers itself, sends you to a consent page to choose the workspace, permission and expiry, and receives a workspace token you can revoke under Agent access at any time.
3. Give it a task
- “Summarize spend and revenue for each app this week. Keep currencies separate.”
- “Create a shorter version of this welcome flow and save it as a draft.”
- “Compare the completion results for our two web variants.”
- “Import this daily report using the existing source name.”
Writing, publishing and team management each require the corresponding role. Publishing a funnel or starting a test is a separate action from saving a draft.
Use the HTTP API directly
Send Authorization: Bearer YOUR_TOKEN to the local API. Browser session cookies are not required. Tokens work only inside their workspace.
GET http://127.0.0.1:3411/gateway/api/w/WORKSPACE_ID/state Authorization: Bearer YOUR_TOKEN
Discover tool input schemas at /gateway/agent-contract on port 3411. The repository’s docs/agent-access.md contains the full endpoint map. Revision conflicts return 409; read the current record before retrying an edit. An expired or revoked token returns 401.
What agents can do today
Read workspace reports and results; create and edit app records, funnels, tests, connection mappings and pricing references; publish or unpublish web funnels; start or stop web tests; import reports; create and revoke invitation links; and manage teammate roles and app access.
Account sign-in, workspace creation and token management stay in the dashboard. Everything else the console does is available here with the same permission, revision and activation checks: reporting connections sync only after their credentials verify, hosted checkout collects payments only through a verified Stripe connection, and a native test activates only with an app environment and a start time.