@attryio/sdk-core
v0.1.6
Published
Shared Attry SDK engine for mobile app analytics, attribution, deep links, deferred deep links, and revenue events.
Maintainers
Readme
@attryio/sdk-core
Shared JavaScript engine for Attry, a mobile app analytics and attribution platform for campaign analytics, app user analytics, deep links, deferred deep links, and revenue events.
Most mobile apps should not install this package directly. Use one of the platform SDKs instead:
- React Native:
@attryio/react-native - Capacitor:
@attryio/capacitor
@attryio/sdk-core is the transport, queue, storage, event normalization, revenue normalization, and deep link resolution layer used by those platform SDKs. It is useful when you are building a custom Attry integration, a new platform SDK, or a server/runtime adapter.
Links
- Website: attry.io
- Dashboard: app.attry.io
- Event tracking docs: attry.io/resources/event-tracking
- Standard events: attry.io/resources/standard-events
- Domain setup: attry.io/resources/domain-setup
Install
npm install @attryio/sdk-coreAgain: customer apps normally install @attryio/react-native or @attryio/capacitor. Core has no native lifecycle hooks, no native storage by default, and no platform-specific install attribution collection on its own.
Basic usage
import { Attry } from "@attryio/sdk-core";
const attry = await new Attry({
appId: "457064853",
apiKey: "attry_live_...",
platform: "ios"
}).init();
await attry.track("flashcards_generated", {
properties: {
deckId: "deck_123",
cardCount: 18
}
});Purchase intent and revenue
Use initiatePurchase when the user starts a checkout, subscription, or paywall purchase flow.
await attry.initiatePurchase({
properties: {
productId: "pro_monthly",
placement: "paywall"
}
});Use purchase when money was actually captured or a paid conversion happened. purchase must include value or amountMinor plus currency.
await attry.purchase({
value: 31.42,
currency: "USD",
productId: "pro_monthly",
transactionId: "txn_123",
store: "app_store"
});Attry stores revenue as stable minor-unit fields, so campaign revenue is not guessed from arbitrary custom properties.
Standard events
Attry accepts custom event names, but these standard names are reserved for dashboard reporting:
| Event | Sent by | Purpose |
| --- | --- | --- |
| install | Platform SDK | First SDK install for the current app installation. |
| open | Platform SDK | App opened or became active. |
| session_started | Platform SDK | A new app usage session started. |
| session_ended | Platform SDK | A session ended after backgrounding or timeout. |
| app_foreground | Platform SDK | App returned to the foreground. |
| app_background | Platform SDK | App moved to the background. |
| deep_link_opened | Platform SDK | App opened from a deep link, universal link, or app link. |
| initiate_purchase | App | User started a purchase or subscription flow. |
| purchase | App | Paid conversion or purchase revenue. Requires revenue. |
Everything else can be sent as a custom event with track("your_event_name", { properties }).
What core provides
- Event queueing and batch delivery to
https://api.attry.io/v1/events/batch. - Stable installation and anonymous ID generation using the configured storage adapter.
track,identify,initiatePurchase,purchase,resolveInstall,resolveDeepLink, andsubmitAppleAdsToken.- Revenue validation for
purchase. - URL parsing helpers for Attry links.
- Storage and transport interfaces for platform SDKs.
Need help?
Email [email protected] or open the Attry dashboard.
