AttryResourcesEvent tracking

Log events with the Attry SDK

Install the React Native or Capacitor package, initialize Attry with the App ID and Live SDK key from Settings, then let auto events run while you send the product actions that matter.

SDK flow
Auto events plus custom product actions

The SDK handles app lifecycle signals. Your app sends business events such as purchase intent, purchases, and feature usage.

Install
@attryio/react-native

Use this package for React Native apps.

Install
@attryio/capacitor

Use this package for Capacitor apps.

Open SDK settings
Initialize
App ID + Live key

Use the values shown in Settings. Customers do not need to install sdk-core directly.

Auto events
install / open

The SDK records lifecycle, session, and deep link open events where platform hooks are available.

Custom events
track + properties

Send app-specific actions with structured properties for dashboard filtering later.

Event tracking setup

The minimum production flow is initialize, verify auto events, then wire the events that define user quality and revenue.

01

Install the platform package

Use @attryio/react-native for React Native or @attryio/capacitor for Capacitor. Do not install sdk-core directly in customer apps.

02

Initialize once

Initialize Attry at app startup with the App ID and Live SDK key from Settings.

03

Track product events

Use track for custom behavior, initiatePurchase for purchase intent, and purchase for revenue.

04

Validate in Events

Open the Events page in the dashboard and confirm event name, count, campaign, source, revenue, store, and time.

Common logging calls

initiatePurchase
Standard helper
Use when a checkout, subscription, or purchase flow starts.
purchase
Revenue helper
Use for one-time purchases or paid conversion events. Requires value or amountMinor plus currency.
track
Custom events
Use for product-specific actions with structured properties.

React Native setup

React Native apps should install the Attry React Native package and initialize it once near app startup. The package includes the shared event queue, batching, retry behavior, lifecycle tracking, deep link handling, Android Install Referrer hooks, and iOS AdServices hooks when native bridges are available.

Install package: `npm install @attryio/react-native`
Initialize with the App ID and Live SDK key from Settings
Call `handleOpenURL` when your app receives a deep link
Use `purchase` for revenue and `initiatePurchase` for purchase intent

Capacitor setup

Capacitor apps should install the Attry Capacitor package, sync native projects, and initialize Attry from the app startup path. The SDK uses Capacitor App and Device APIs for lifecycle and device context where possible.

Install package: `npm install @attryio/capacitor`
Run Capacitor sync after installing
Initialize with the App ID and Live SDK key from Settings
Use the same event names and revenue helpers as React Native

Custom event tracking

Use custom events for app-specific actions that are not covered by standard event names. Event names should be snake_case and stable. Details belong in properties, not in the event name.

Good: `template_saved` with `{ templateType: "flashcard" }`
Avoid: `template_saved_flashcard_dark_mode_variant_b`
Use properties for screen names, experiment IDs, content IDs, plan names, and UI context
Use standard events when the action maps to install, open, deep link open, purchase intent, or purchase revenue

Revenue event tracking

Use helper methods for revenue events. The SDK accepts decimal value for developer ergonomics, converts it to minor units, and sends the normalized revenue object to the API. This keeps dashboard revenue accurate across platforms.

`value`: decimal amount, such as 31.42
`currency`: 3-letter ISO currency code, such as USD
`amountMinor`: optional integer minor-unit amount if you already have cents
`productId`, `transactionId`, `orderId`: recommended for purchase validation and de-duplication

Device and app context

The SDK collects non-sensitive app and device context where platform APIs expose it: app version/build, OS version, device model, locale, timezone, country code, screen size, and SDK version. Location is not GPS by default; Attry uses SDK-provided context and trusted request headers for country, region, and city rollups.

Troubleshooting

Events do not appear in the dashboard

Check that the App ID and Live SDK key match the selected app in Settings, then confirm the device can reach api.attry.io.

Revenue is missing

Use attry.purchase. Purchase requires value or amountMinor and currency.

Too many event names

Keep event names stable and move variants into properties. This keeps the Events table and campaign reports readable.

React Native example

The same event methods are available from the Capacitor package after initialization.

import { createAttryReactNative } from "@attryio/react-native";

const attry = await createAttryReactNative({
  appId: "457064853",
  apiKey: "attry_live_..."
});
await attry.initiatePurchase({
  properties: { screen: "pro_paywall", plan: "monthly" }
});

await attry.purchase({
  value: 31.42,
  currency: "USD",
  productId: "pro_monthly",
  transactionId: "txn_123"
});

Do customers need @attryio/sdk-core?

No. Customer apps should install @attryio/react-native or @attryio/capacitor. The sdk-core package is an internal shared engine used by those platform packages.

Can I pass custom parameters?

Yes. Pass custom parameters through properties. They are stored with the event and can be used later for filtering, validation, and product analytics.

Which event is required for revenue?

Use purchase for one-time purchases, subscription conversions, and subscription revenue. It must include value or amountMinor plus currency.