@attryio/react-native 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "AttryReactNative"
7
+ s.version = package["version"]
8
+ s.summary = "Attry React Native SDK"
9
+ s.description = "React Native SDK for Attry mobile attribution, app events, and store attribution."
10
+ s.homepage = "https://attry.io"
11
+ s.license = { :type => "Apache-2.0" }
12
+ s.author = { "Attry" => "hello@attry.io" }
13
+ s.platforms = { :ios => "13.0" }
14
+ s.source = { :git => "https://github.com/mozhn/attry.io.git", :tag => "v#{s.version}" }
15
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
16
+ s.frameworks = "AdServices"
17
+ s.swift_version = "5.0"
18
+ s.dependency "React-Core"
19
+ end
package/README.md CHANGED
@@ -1,40 +1,144 @@
1
1
  # @attryio/react-native
2
2
 
3
- React Native SDK for Attry mobile attribution.
3
+ React Native SDK for [Attry](https://attry.io), a mobile app analytics and attribution platform for campaign analytics, app user analytics, deep links, deferred deep links, and revenue events.
4
+
5
+ Use this package when your app is built with React Native. It collects install/open/session signals automatically, keeps one stable installation ID, resolves Attry deep links, and lets you send custom product events with structured properties.
6
+
7
+ ## Links
8
+
9
+ - Website: [attry.io](https://attry.io)
10
+ - Dashboard: [app.attry.io](https://app.attry.io)
11
+ - Event tracking docs: [attry.io/resources/event-tracking](https://attry.io/resources/event-tracking)
12
+ - Standard events: [attry.io/resources/standard-events](https://attry.io/resources/standard-events)
13
+ - Domain setup: [attry.io/resources/domain-setup](https://attry.io/resources/domain-setup)
14
+
15
+ ## Install
16
+
17
+ ```sh
18
+ npm install @attryio/react-native
19
+ ```
20
+
21
+ For iOS, install pods after adding the package:
22
+
23
+ ```sh
24
+ cd ios && pod install
25
+ ```
26
+
27
+ Use the App ID and live SDK key from **Settings -> SDK install** in your Attry dashboard. Each Attry app has one App ID and one live key; you do not need separate keys for iOS and Android.
28
+
29
+ ## Quick start
30
+
31
+ Create the client once during app startup.
4
32
 
5
33
  ```ts
6
34
  import { createAttryReactNative } from "@attryio/react-native";
7
35
 
8
- const attry = await createAttryReactNative({
36
+ export const attry = await createAttryReactNative({
9
37
  appId: "457064853",
10
38
  apiKey: "attry_live_..."
11
39
  });
40
+ ```
41
+
42
+ The SDK starts with practical defaults:
43
+
44
+ - Tracks the first SDK install, app opens, session starts/ends, foreground/background changes, and deep link opens.
45
+ - Collects React Native context such as platform, app version, build, OS version, device model, locale, timezone, screen, and available country context.
46
+ - Resolves Android Google Play Install Referrer when the native module is available.
47
+ - Requests Apple AdServices attribution tokens on iOS when the native module is available.
48
+ - Batches events and retries failed requests through the shared Attry SDK engine.
49
+
50
+ ## Track custom events
51
+
52
+ Use `track` for app-specific actions. Event names should be stable `snake_case`; details belong in `properties`.
53
+
54
+ ```ts
55
+ await attry.track("flashcards_generated", {
56
+ properties: {
57
+ deckId: "deck_123",
58
+ cardCount: 18,
59
+ source: "lesson"
60
+ }
61
+ });
62
+ ```
12
63
 
64
+ Attach a signed-in user ID with `identify`. This is a method, not an event.
65
+
66
+ ```ts
67
+ attry.identify("user_123");
68
+ ```
69
+
70
+ ## Purchase intent and revenue
71
+
72
+ Use `initiatePurchase` when the user starts a checkout, subscription, or paywall purchase flow.
73
+
74
+ ```ts
13
75
  await attry.initiatePurchase({
14
76
  properties: {
15
77
  productId: "pro_monthly",
16
78
  placement: "paywall"
17
79
  }
18
80
  });
81
+ ```
82
+
83
+ Use `purchase` when money was actually captured or a paid conversion happened. `purchase` must include `value` or `amountMinor` plus `currency`.
19
84
 
85
+ ```ts
20
86
  await attry.purchase({
21
87
  value: 31.42,
22
88
  currency: "USD",
23
89
  productId: "pro_monthly",
24
- transactionId: "txn_123"
90
+ transactionId: "txn_123",
91
+ store: "app_store",
92
+ properties: {
93
+ plan: "monthly"
94
+ }
25
95
  });
26
96
  ```
27
97
 
28
- The SDK auto-tracks first SDK install, app opens, sessions, foreground/background transitions, deep link opens, Apple AdServices tokens on iOS, and Google Play Install Referrer on Android when the native modules are available.
98
+ Attry stores revenue as stable minor-unit fields, so campaign revenue is not guessed from arbitrary custom properties.
29
99
 
30
100
  ## Standard events
31
101
 
32
102
  Attry accepts custom event names, but these standard names are reserved for dashboard reporting:
33
103
 
34
- - Lifecycle: `install`, `open`, `session_started`, `session_ended`, `app_foreground`, `app_background`, `deep_link_opened`
35
- - Revenue: `purchase`
36
- - Commerce/content: `initiate_purchase`
104
+ | Event | Sent by | Purpose |
105
+ | --- | --- | --- |
106
+ | `install` | SDK | First SDK install for the current app installation. |
107
+ | `open` | SDK | App opened or became active. |
108
+ | `session_started` | SDK | A new app usage session started. |
109
+ | `session_ended` | SDK | A session ended after backgrounding or timeout. |
110
+ | `app_foreground` | SDK | App returned to the foreground. |
111
+ | `app_background` | SDK | App moved to the background. |
112
+ | `deep_link_opened` | SDK | App opened from a deep link, universal link, or app link. |
113
+ | `initiate_purchase` | App | User started a purchase or subscription flow. |
114
+ | `purchase` | App | Paid conversion or purchase revenue. Requires revenue. |
115
+
116
+ Everything else can be sent as a custom event with `track("your_event_name", { properties })`.
117
+
118
+ ## Configuration
119
+
120
+ ```ts
121
+ const attry = await createAttryReactNative({
122
+ appId: "457064853",
123
+ apiKey: "attry_live_...",
124
+ autoTrackLifecycleEvents: true,
125
+ autoTrackDeepLinks: true,
126
+ autoCollectInstallAttribution: true,
127
+ sessionTimeoutMs: 30 * 60 * 1000,
128
+ context: {
129
+ appName: "Noteasy"
130
+ }
131
+ });
132
+ ```
133
+
134
+ Useful options:
135
+
136
+ - `endpoint`: custom Attry API endpoint. Defaults to `https://api.attry.io`.
137
+ - `autoTrackLifecycleEvents`: disable automatic lifecycle events when set to `false`.
138
+ - `autoTrackDeepLinks`: disable automatic deep link tracking when set to `false`.
139
+ - `autoCollectInstallAttribution`: disable Apple AdServices and Play Install Referrer collection when set to `false`.
140
+ - `context`: extra app, device, or release metadata attached to every event.
37
141
 
38
- `identify()` is a convenience method that attaches a known user ID to later events; it is not sent as a standard event. Any other product action can still be sent with `track("your_event_name", { properties })`.
142
+ ## Need help?
39
143
 
40
- Purchase events must include `value` or `amountMinor` plus `currency`. Attry stores them as stable minor-unit revenue fields so dashboard revenue is not guessed from arbitrary properties.
144
+ Email [hello@attry.io](mailto:hello@attry.io) or open the [Attry dashboard](https://app.attry.io).
@@ -0,0 +1,37 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ }
6
+ dependencies {
7
+ classpath("com.android.tools.build:gradle:8.7.3")
8
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21")
9
+ }
10
+ }
11
+
12
+ def safeExtGet(prop, fallback) {
13
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
14
+ }
15
+
16
+ apply plugin: "com.android.library"
17
+ apply plugin: "org.jetbrains.kotlin.android"
18
+
19
+ android {
20
+ namespace "io.attry.reactnative"
21
+ compileSdkVersion safeExtGet("compileSdkVersion", 35)
22
+
23
+ defaultConfig {
24
+ minSdkVersion safeExtGet("minSdkVersion", 23)
25
+ targetSdkVersion safeExtGet("targetSdkVersion", 35)
26
+ }
27
+ }
28
+
29
+ repositories {
30
+ google()
31
+ mavenCentral()
32
+ }
33
+
34
+ dependencies {
35
+ implementation("com.facebook.react:react-android")
36
+ implementation("com.android.installreferrer:installreferrer:2.2")
37
+ }
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Attry, ATTRY_EVENTS, MemoryStorage, parseAttryUrl } from "@attryio/sdk-core";
2
2
  const SDK_NAME = "attry-react-native";
3
- const SDK_VERSION = "0.1.5";
3
+ const SDK_VERSION = "0.1.7";
4
4
  export { parseAttryUrl };
5
5
  export async function createAttryReactNative(config) {
6
6
  const rn = await loadReactNative();
@@ -1,4 +1,5 @@
1
1
  import Foundation
2
+ import React
2
3
 
3
4
  #if canImport(AdServices)
4
5
  import AdServices
package/package.json CHANGED
@@ -1,9 +1,33 @@
1
1
  {
2
2
  "name": "@attryio/react-native",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
+ "description": "React Native SDK for Attry mobile app analytics, attribution, deep links, deferred deep links, and revenue events.",
4
5
  "private": false,
5
6
  "license": "Apache-2.0",
6
7
  "type": "module",
8
+ "homepage": "https://attry.io",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/mozhn/attry.io.git",
12
+ "directory": "packages/sdk-react-native"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/mozhn/attry.io/issues"
16
+ },
17
+ "keywords": [
18
+ "attry",
19
+ "react native analytics",
20
+ "react native attribution",
21
+ "mobile analytics",
22
+ "mobile attribution",
23
+ "deep links",
24
+ "deferred deep links",
25
+ "app analytics",
26
+ "campaign analytics",
27
+ "revenue analytics",
28
+ "apple search ads",
29
+ "install referrer"
30
+ ],
7
31
  "main": "./dist/index.js",
8
32
  "types": "./dist/index.d.ts",
9
33
  "exports": {
@@ -22,6 +46,8 @@
22
46
  "dist",
23
47
  "ios",
24
48
  "android",
49
+ "AttryReactNative.podspec",
50
+ "react-native.config.js",
25
51
  "README.md",
26
52
  "package.json"
27
53
  ],
@@ -29,7 +55,7 @@
29
55
  "access": "public"
30
56
  },
31
57
  "dependencies": {
32
- "@attryio/sdk-core": "0.1.3",
58
+ "@attryio/sdk-core": "0.1.4",
33
59
  "@react-native-async-storage/async-storage": "^2.2.0"
34
60
  },
35
61
  "peerDependencies": {
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ sourceDir: "./android",
6
+ packageImportPath: "import io.attry.reactnative.AttryPackage;",
7
+ packageInstance: "new AttryPackage()"
8
+ },
9
+ ios: {}
10
+ }
11
+ }
12
+ };