@traqio/react-native 0.2.2 → 0.2.4
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.
- package/README.md +8 -3
- package/android/build.gradle +2 -2
- package/build/native.d.ts.map +1 -1
- package/build/native.js +14 -0
- package/build/native.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/TraqioAdvertisingId.swift +24 -0
- package/ios/TraqioModule.swift +5 -0
- package/package.json +3 -2
- package/src/native.ts +14 -0
package/README.md
CHANGED
|
@@ -101,13 +101,18 @@ attributes by that id (**Unity Ads**, **AppLovin**):
|
|
|
101
101
|
Traqio.init({ sdkKey: "SDK_KEY", endpoint: "https://api.traqio.app", collectAdvertisingId: true });
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
- **iOS**: ask ATT in your app
|
|
105
|
-
the user said yes.
|
|
104
|
+
- **iOS**: ask ATT in your app — whenever your onboarding does — and link AdSupport; the
|
|
105
|
+
IDFA is read only if the user said yes. Asked after `init`? The SDK re-reads it at every
|
|
106
|
+
start and return to the foreground and sends it once (`POST /ingest/advertising-id`).
|
|
106
107
|
- **Android**: add `com.google.android.gms:play-services-ads-identifier` and the
|
|
107
108
|
`com.google.android.gms.permission.AD_ID` permission; nothing is sent when the user
|
|
108
109
|
limited ad tracking.
|
|
109
110
|
|
|
110
|
-
It
|
|
111
|
+
It goes with the install, or once later when ATT is granted after the first launch. Traqio
|
|
112
|
+
matches it hashed against tracked clicks, keeps it on that install, and sends it to Meta
|
|
113
|
+
(`madid`, with `advertiser_tracking_enabled: true` — iOS only under ATT `authorized`) and
|
|
114
|
+
TikTok with the device's later conversions. Dropped when the user denies consent or
|
|
115
|
+
withdraws ATT. Never used as the user's identity.
|
|
111
116
|
|
|
112
117
|
## Ad revenue (AdMob, AppLovin MAX)
|
|
113
118
|
|
package/android/build.gradle
CHANGED
|
@@ -6,7 +6,7 @@ apply plugin: 'kotlin-android'
|
|
|
6
6
|
apply plugin: 'maven-publish'
|
|
7
7
|
|
|
8
8
|
group = 'io.khufu.traqio'
|
|
9
|
-
version = '0.2.
|
|
9
|
+
version = '0.2.4'
|
|
10
10
|
|
|
11
11
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
12
12
|
apply from: expoModulesCorePlugin
|
|
@@ -28,7 +28,7 @@ android {
|
|
|
28
28
|
defaultConfig {
|
|
29
29
|
minSdk safeExtGet("minSdkVersion", 24)
|
|
30
30
|
versionCode 1
|
|
31
|
-
versionName "0.2.
|
|
31
|
+
versionName "0.2.4"
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
compileOptions {
|
package/build/native.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EAErB,YAAY,
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EAErB,YAAY,EAEb,MAAM,cAAc,CAAC;AAUtB;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,qBAAqB,CAe5E;AAQD,wBAAgB,eAAe,IAAI,YAAY,GAAG,SAAS,CA8E1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,WAAW,EACpB,UAAU,UAAQ,GACjB,IAAI,CAQN"}
|
package/build/native.js
CHANGED
|
@@ -86,6 +86,20 @@ function getNativeBridge() {
|
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
|
+
// iOS: the ATT status the app already obtained — read, never requested
|
|
90
|
+
// (decision cmvjohk6). Null on Android, on a native build that predates the
|
|
91
|
+
// method, or when the app does not link AppTrackingTransparency.
|
|
92
|
+
getTrackingAuthorization: async () => {
|
|
93
|
+
try {
|
|
94
|
+
const status = await m.getTrackingAuthorization?.();
|
|
95
|
+
return status === "not_determined" || status === "restricted" || status === "denied" || status === "authorized"
|
|
96
|
+
? status
|
|
97
|
+
: null;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
},
|
|
89
103
|
// Debug mode (InitOptions.debug): the host app is debuggable / DEBUG, or runs
|
|
90
104
|
// on an emulator / simulator. `__DEV__` already covers a Metro dev bundle; this
|
|
91
105
|
// catches a release bundle in a debug native build or on a simulator. False on
|
package/build/native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":";;AAqBA,4DAeC;AAQD,0CA8EC;AAYD,8DAYC;AAtID,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9F,CAAC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,GAAY;IACnD,MAAM,CAAC,GAAG,GAAiD,CAAC;IAC5D,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACvC,sEAAsE;QACtE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACrD,CAAC;IACD,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,C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;wBAC7G,CAAC,CAAE,MAAgC;wBACnC,CAAC,CAAC,IAAI,CAAC;gBACX,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YACD,8EAA8E;YAC9E,gFAAgF;YAChF,+EAA+E;YAC/E,4EAA4E;YAC5E,YAAY,EAAE,KAAK,IAAI,EAAE;gBACvB,IAAI,CAAC;oBACH,OAAO,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC;gBAC7C,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC,CAAC,+CAA+C;IACnE,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,yBAAyB,CACvC,SAAiB,EACjB,MAAoB,EACpB,UAAU,GAAG,KAAK;IAElB,IAAI,CAAC;QACH,8DAA8D;QAC9D,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAC7D,mBAAmB,CAAC,QAAQ,CAAC,CAAC,qBAAqB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IACvF,CAAC;IAAC,MAAM,CAAC;QACP,sBAAsB;IACxB,CAAC;AACH,CAAC"}
|
package/expo-module.config.json
CHANGED
|
@@ -36,6 +36,30 @@ enum TraqioAdvertisingId {
|
|
|
36
36
|
#endif
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/// The ATT status the APP obtained — "not_determined" | "restricted" | "denied" |
|
|
40
|
+
/// "authorized" — or nil when the app does not link AppTrackingTransparency (it
|
|
41
|
+
/// never asked). Read by default and on every launch: it is a status, not an
|
|
42
|
+
/// identifier, and reading it never prompts. The server needs it to tell Meta the
|
|
43
|
+
/// truth (`advertiser_tracking_enabled`), which it otherwise claimed true for every
|
|
44
|
+
/// iPhone (todo cmwl6oko).
|
|
45
|
+
static func trackingAuthorization() -> String? {
|
|
46
|
+
#if canImport(ObjectiveC)
|
|
47
|
+
if #available(iOS 14, macOS 11, tvOS 14, *) {
|
|
48
|
+
switch trackingStatus() {
|
|
49
|
+
case 0: return "not_determined"
|
|
50
|
+
case 1: return "restricted"
|
|
51
|
+
case 2: return "denied"
|
|
52
|
+
case 3: return "authorized"
|
|
53
|
+
default: return nil
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Before iOS 14 there was no ATT: tracking was governed by "Limit Ad Tracking".
|
|
57
|
+
return nil
|
|
58
|
+
#else
|
|
59
|
+
return nil
|
|
60
|
+
#endif
|
|
61
|
+
}
|
|
62
|
+
|
|
39
63
|
#if canImport(ObjectiveC)
|
|
40
64
|
/// `ATTrackingManager.trackingAuthorizationStatus`, a class property returning an
|
|
41
65
|
/// NSUInteger — called through its IMP because `perform` only returns objects.
|
package/ios/TraqioModule.swift
CHANGED
|
@@ -74,6 +74,11 @@ public class TraqioModule: Module {
|
|
|
74
74
|
return TraqioAdvertisingId.read()
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
// The ATT status the app already obtained — never a prompt (decision cmvjohk6).
|
|
78
|
+
AsyncFunction("getTrackingAuthorization") { () -> String? in
|
|
79
|
+
return TraqioAdvertisingId.trackingAuthorization()
|
|
80
|
+
}
|
|
81
|
+
|
|
77
82
|
AsyncFunction("getAttributionToken") { () -> String? in
|
|
78
83
|
#if canImport(AdServices)
|
|
79
84
|
if #available(iOS 14.3, *) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traqio/react-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Traqio SDK for React Native / Expo — deterministic install attribution (Play Install Referrer) + SKAN. No IDFA, no fingerprinting.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"README.md"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@traqio/core": "0.
|
|
47
|
+
"@traqio/core": "0.6.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@react-native-async-storage/async-storage": ">=1.21.0",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
+
"expo-modules-autolinking": "58.0.16",
|
|
70
71
|
"typescript": "^5",
|
|
71
72
|
"vitest": "^4.1.12"
|
|
72
73
|
},
|
package/src/native.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
InstallReferrerResult,
|
|
4
4
|
InstallReferrerStatus,
|
|
5
5
|
NativeBridge,
|
|
6
|
+
TrackingAuthorization,
|
|
6
7
|
} from "@traqio/core";
|
|
7
8
|
|
|
8
9
|
// `require` is provided by the React Native / Metro runtime (we import the native
|
|
@@ -91,6 +92,19 @@ export function getNativeBridge(): NativeBridge | undefined {
|
|
|
91
92
|
return null;
|
|
92
93
|
}
|
|
93
94
|
},
|
|
95
|
+
// iOS: the ATT status the app already obtained — read, never requested
|
|
96
|
+
// (decision cmvjohk6). Null on Android, on a native build that predates the
|
|
97
|
+
// method, or when the app does not link AppTrackingTransparency.
|
|
98
|
+
getTrackingAuthorization: async () => {
|
|
99
|
+
try {
|
|
100
|
+
const status: unknown = await m.getTrackingAuthorization?.();
|
|
101
|
+
return status === "not_determined" || status === "restricted" || status === "denied" || status === "authorized"
|
|
102
|
+
? (status as TrackingAuthorization)
|
|
103
|
+
: null;
|
|
104
|
+
} catch {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
94
108
|
// Debug mode (InitOptions.debug): the host app is debuggable / DEBUG, or runs
|
|
95
109
|
// on an emulator / simulator. `__DEV__` already covers a Metro dev bundle; this
|
|
96
110
|
// catches a release bundle in a debug native build or on a simulator. False on
|