affise-attribution-lib 1.0.0

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.
Files changed (108) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +549 -0
  3. package/affise-attribution-native.podspec +37 -0
  4. package/android/build.gradle +87 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/libs/attribution-release.aar +0 -0
  7. package/android/libs/oaid_sdk_1.0.26.aar +0 -0
  8. package/android/src/main/AndroidManifest.xml +4 -0
  9. package/android/src/main/java/com/affise/attribution/react/AffiseAttributionNativeModule.kt +147 -0
  10. package/android/src/main/java/com/affise/attribution/react/AffiseAttributionNativePackage.kt +17 -0
  11. package/android/src/main/java/com/affise/attribution/react/ext/AffiseInitPropertiesExt.kt +29 -0
  12. package/android/src/main/java/com/affise/attribution/react/ext/AutoCatchingTypeExt.kt +15 -0
  13. package/android/src/main/java/com/affise/attribution/react/ext/JSONObjectExt.kt +15 -0
  14. package/android/src/main/java/com/affise/attribution/react/ext/PredefinedParametersExt.kt +82 -0
  15. package/android/src/main/java/com/affise/attribution/react/ext/TouchTypeExt.kt +12 -0
  16. package/android/src/main/java/com/affise/attribution/react/factories/AffiseBaseEvensFactory.kt +97 -0
  17. package/android/src/main/java/com/affise/attribution/react/factories/AffiseEvensFactory.kt +781 -0
  18. package/android/src/main/java/com/affise/attribution/react/factories/AffiseSubtypeEventsFactory.kt +266 -0
  19. package/ios/AffiseAttributionNative-Bridging-Header.h +3 -0
  20. package/ios/AffiseAttributionNative.m +90 -0
  21. package/ios/AffiseAttributionNative.swift +148 -0
  22. package/ios/AffiseAttributionNative.xcodeproj/project.pbxproj +305 -0
  23. package/ios/extensions/AffiseInitPropertiesExt.swift +29 -0
  24. package/ios/extensions/PredefinedParametersExt.swift +83 -0
  25. package/ios/extensions/TouchTypeExt.swift +13 -0
  26. package/ios/factories/AffiseBaseEvensFactory.swift +110 -0
  27. package/ios/factories/AffiseEvensFactory.swift +782 -0
  28. package/ios/factories/AffiseSubtypeEventsFactory.swift +261 -0
  29. package/ios/log/Log.swift +19 -0
  30. package/ios/log/RCTSwiftLog.h +16 -0
  31. package/ios/log/RCTSwiftLog.m +32 -0
  32. package/package.json +162 -0
  33. package/src/AffiseInitProperties.ts +32 -0
  34. package/src/Export.ts +73 -0
  35. package/src/events/AutoCatchingType.ts +9 -0
  36. package/src/events/PredefinedParameters.ts +75 -0
  37. package/src/events/TouchType.ts +5 -0
  38. package/src/events/base/AffiseEvent.ts +60 -0
  39. package/src/events/base/NativeEvent.ts +9 -0
  40. package/src/events/custom/CustomId01Event.ts +21 -0
  41. package/src/events/custom/CustomId02Event.ts +21 -0
  42. package/src/events/custom/CustomId03Event.ts +21 -0
  43. package/src/events/custom/CustomId04Event.ts +21 -0
  44. package/src/events/custom/CustomId05Event.ts +21 -0
  45. package/src/events/custom/CustomId06Event.ts +21 -0
  46. package/src/events/custom/CustomId07Event.ts +21 -0
  47. package/src/events/custom/CustomId08Event.ts +21 -0
  48. package/src/events/custom/CustomId09Event.ts +21 -0
  49. package/src/events/custom/CustomId10Event.ts +21 -0
  50. package/src/events/predefined/AchieveLevelEvent.ts +14 -0
  51. package/src/events/predefined/AddPaymentInfoEvent.ts +14 -0
  52. package/src/events/predefined/AddToCartEvent.ts +14 -0
  53. package/src/events/predefined/AddToWishlistEvent.ts +14 -0
  54. package/src/events/predefined/ClickAdvEvent.ts +14 -0
  55. package/src/events/predefined/CompleteRegistrationEvent.ts +14 -0
  56. package/src/events/predefined/CompleteStreamEvent.ts +14 -0
  57. package/src/events/predefined/CompleteTrialEvent.ts +14 -0
  58. package/src/events/predefined/CompleteTutorialEvent.ts +14 -0
  59. package/src/events/predefined/ContentItemsViewEvent.ts +13 -0
  60. package/src/events/predefined/DeepLinkedEvent.ts +13 -0
  61. package/src/events/predefined/InitiatePurchaseEvent.ts +14 -0
  62. package/src/events/predefined/InitiateStreamEvent.ts +14 -0
  63. package/src/events/predefined/InviteEvent.ts +14 -0
  64. package/src/events/predefined/LastAttributedTouchEvent.ts +15 -0
  65. package/src/events/predefined/ListViewEvent.ts +13 -0
  66. package/src/events/predefined/LoginEvent.ts +14 -0
  67. package/src/events/predefined/OpenedFromPushNotificationEvent.ts +13 -0
  68. package/src/events/predefined/PurchaseEvent.ts +14 -0
  69. package/src/events/predefined/RateEvent.ts +14 -0
  70. package/src/events/predefined/ReEngageEvent.ts +13 -0
  71. package/src/events/predefined/ReserveEvent.ts +14 -0
  72. package/src/events/predefined/SearchEvent.ts +14 -0
  73. package/src/events/predefined/ShareEvent.ts +14 -0
  74. package/src/events/predefined/SpendCreditsEvent.ts +14 -0
  75. package/src/events/predefined/StartRegistrationEvent.ts +14 -0
  76. package/src/events/predefined/StartTrialEvent.ts +14 -0
  77. package/src/events/predefined/StartTutorialEvent.ts +14 -0
  78. package/src/events/predefined/SubscribeEvent.ts +14 -0
  79. package/src/events/predefined/TravelBookingEvent.ts +13 -0
  80. package/src/events/predefined/UnlockAchievementEvent.ts +14 -0
  81. package/src/events/predefined/UnsubscribeEvent.ts +14 -0
  82. package/src/events/predefined/UpdateEvent.ts +13 -0
  83. package/src/events/predefined/ViewAdvEvent.ts +14 -0
  84. package/src/events/predefined/ViewCartEvent.ts +13 -0
  85. package/src/events/predefined/ViewItemEvent.ts +13 -0
  86. package/src/events/predefined/ViewItemsEvent.ts +13 -0
  87. package/src/events/subscription/BaseSubscriptionEvent.ts +32 -0
  88. package/src/events/subscription/ConvertedOfferEvent.ts +13 -0
  89. package/src/events/subscription/ConvertedOfferFromRetryEvent.ts +14 -0
  90. package/src/events/subscription/ConvertedTrialEvent.ts +13 -0
  91. package/src/events/subscription/ConvertedTrialFromRetryEvent.ts +13 -0
  92. package/src/events/subscription/FailedOfferFromRetryEvent.ts +13 -0
  93. package/src/events/subscription/FailedOfferiseEvent.ts +13 -0
  94. package/src/events/subscription/FailedSubscriptionEvent.ts +13 -0
  95. package/src/events/subscription/FailedSubscriptionFromRetryEvent.ts +13 -0
  96. package/src/events/subscription/FailedTrialEvent.ts +13 -0
  97. package/src/events/subscription/FailedTrialFromRetryEvent.ts +13 -0
  98. package/src/events/subscription/InitialOfferEvent.ts +13 -0
  99. package/src/events/subscription/InitialSubscriptionEvent.ts +13 -0
  100. package/src/events/subscription/InitialTrialEvent.ts +13 -0
  101. package/src/events/subscription/OfferInRetryEvent.ts +13 -0
  102. package/src/events/subscription/ReactivatedSubscriptionEvent.ts +13 -0
  103. package/src/events/subscription/RenewedSubscriptionEvent.ts +13 -0
  104. package/src/events/subscription/RenewedSubscriptionFromRetryEvent.ts +13 -0
  105. package/src/events/subscription/SubscriptionInRetryEvent.ts +13 -0
  106. package/src/events/subscription/SubscriptionParameters.ts +36 -0
  107. package/src/events/subscription/TrialInRetryEvent.ts +13 -0
  108. package/src/index.tsx +172 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Affise, Inc. | https://affise.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,549 @@
1
+ # Affise Attribution React Native library
2
+
3
+ - [Affise Attribution React Native library](#affise-attribution-react-native-library)
4
+ - [Description](#description)
5
+ - [Quick start](#quick-start)
6
+ - [Integration](#integration)
7
+ - [Integrate npm package](#integrate-npm-package)
8
+ - [Initialize](#initialize)
9
+ - [Requirements](#requirements)
10
+ - [Android](#android)
11
+ - [iOS](#ios)
12
+ - [Features](#features)
13
+ - [Device identifiers collection](#device-identifiers-collection)
14
+ - [Events tracking](#events-tracking)
15
+ - [Custom events tracking](#custom-events-tracking)
16
+ - [Predefined event parameters](#predefined-event-parameters)
17
+ - [Events buffering](#events-buffering)
18
+ - [Advertising Identifier (google) tracking](#advertising-identifier-google-tracking)
19
+ - [Open Advertising Identifier (huawei) tracking](#open-advertising-identifier-huawei-tracking)
20
+ - [Install referrer tracking](#install-referrer-tracking)
21
+ - [Push token tracking](#push-token-tracking)
22
+ - [Reinstall Uninstall tracking](#reinstall-uninstall-tracking)
23
+ - [APK preinstall tracking](#apk-preinstall-tracking)
24
+ - [Deeplinks](#deeplinks)
25
+ - [Android](#android-1)
26
+ - [Offline mode](#offline-mode)
27
+ - [Disable tracking](#disable-tracking)
28
+ - [Disable background tracking](#disable-background-tracking)
29
+ - [GDPR right to be forgotten](#gdpr-right-to-be-forgotten)
30
+ - [Get referrer](#get-referrer)
31
+
32
+ # Description
33
+
34
+ Affise SDK is a software you can use to collect app usage statistics, device identifiers, deeplink usage, track install
35
+ referrer.
36
+
37
+ ## Quick start
38
+
39
+ ## Integration
40
+
41
+ ### Integrate npm package
42
+
43
+ This is a [Node.js](https://nodejs.org/en/) module available through the
44
+ [npm registry](https://www.npmjs.com/).
45
+
46
+ Installation is done using the
47
+ [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
48
+
49
+ ```console
50
+ npm install affise-attribution-lib
51
+ ```
52
+
53
+
54
+ ### Initialize
55
+
56
+ After dependency is added, and project is sync with `npm install` and initialize.
57
+
58
+
59
+ ```typescript
60
+ import {
61
+ Affise,
62
+ AffiseInitProperties
63
+ } from 'affise-attribution-lib';
64
+
65
+
66
+ export default function App() {
67
+
68
+ React.useEffect(() => {
69
+ Affise.init(
70
+ new AffiseInitProperties(
71
+ 'appId',
72
+ false,
73
+ 'partParamName',
74
+ 'partParamNameToken',
75
+ 'appToken',
76
+ 'secretId'
77
+ )
78
+ );
79
+ });
80
+
81
+ return (
82
+ <SafeAreaView>
83
+ </SafeAreaView>
84
+ );
85
+ }
86
+ ```
87
+
88
+
89
+ ### Requirements
90
+
91
+ #### Android
92
+ Minimal Android SDK version is 21
93
+
94
+ For a minimal working functionality your app needs to declare internet permission:
95
+
96
+ ```xml
97
+ <manifest>
98
+ <uses-permission android:name="android.permission.INTERNET"/>
99
+ </manifest>
100
+ ```
101
+
102
+ OAID certificate in your project
103
+ `example/android/app/src/main/assets/oaid.cert.pem`
104
+
105
+ #### iOS
106
+
107
+ Add key `NSUserTrackingUsageDescription` to `Info.plist` as in `example/ios/AffiseAttributionLibExample/Info.plist`
108
+
109
+ ```html
110
+ <key>NSUserTrackingUsageDescription</key>
111
+ <string>This identifier will be used for tracking.</string>
112
+ ```
113
+
114
+
115
+ # Features
116
+
117
+ ### Device identifiers collection
118
+
119
+ To match users with events and data library is sending, these identifiers are collected:
120
+
121
+ - `AFFISE_APP_ID`
122
+ - `AFFISE_PKG_APP_NAME`
123
+ - `AFFISE_APP_NAME_DASHBOARD`
124
+ - `APP_VERSION`
125
+ - `APP_VERSION_RAW`
126
+ - `STORE`
127
+ - `TRACKER_TOKEN`
128
+ - `TRACKER_NAME`
129
+ - `FIRST_TRACKER_TOKEN`
130
+ - `FIRST_TRACKER_NAME`
131
+ - `LAST_TRACKER_TOKEN`
132
+ - `LAST_TRACKER_NAME`
133
+ - `OUTDATED_TRACKER_TOKEN`
134
+ - `INSTALLED_TIME`
135
+ - `FIRST_OPEN_TIME`
136
+ - `INSTALLED_HOUR`
137
+ - `FIRST_OPEN_HOUR`
138
+ - `INSTALL_BEGIN_TIME`
139
+ - `INSTALL_FINISH_TIME`
140
+ - `REFERRAL_TIME`
141
+ - `CREATED_TIME`
142
+ - `CREATED_TIME_MILLI`
143
+ - `CREATED_TIME_HOUR`
144
+ - `UNINSTALL_TIME`
145
+ - `REINSTALL_TIME`
146
+ - `LAST_SESSION_TIME`
147
+ - `CONNECTION_TYPE`
148
+ - `CPU_TYPE`
149
+ - `HARDWARE_NAME`
150
+ - `NETWORK_TYPE`
151
+ - `DEVICE_MANUFACTURER`
152
+ - `PROXY_IP_ADDRESS`
153
+ - `DEEPLINK_CLICK`
154
+ - `DEVICE_ATLAS_ID`
155
+ - `AFFISE_DEVICE_ID`
156
+ - `AFFISE_ALT_DEVICE_ID`
157
+ - `ADID`
158
+ - `ANDROID_ID`
159
+ - `ANDROID_ID_MD5`
160
+ - `MAC_SHA1`
161
+ - `MAC_MD5`
162
+ - `GAID_ADID`
163
+ - `GAID_ADID_MD5`
164
+ - `OAID`
165
+ - `OAID_MD5`
166
+ - `REFTOKEN`
167
+ - `REFTOKENS`
168
+ - `REFERRER`
169
+ - `USER_AGENT`
170
+ - `MCCODE`
171
+ - `MNCODE`
172
+ - `ISP`
173
+ - `REGION`
174
+ - `COUNTRY`
175
+ - `LANGUAGE`
176
+ - `DEVICE_NAME`
177
+ - `DEVICE_TYPE`
178
+ - `OS_NAME`
179
+ - `PLATFORM`
180
+ - `API_LEVEL_OS`
181
+ - `AFFISE_SDK_VERSION`
182
+ - `OS_VERSION`
183
+ - `RANDOM_USER_ID`
184
+ - `AFFISE_SDK_POS`
185
+ - `TIMEZONE_DEV`
186
+ - `LAST_TIME_SESSION`
187
+ - `TIME_SESSION`
188
+ - `AFFISE_SESSION_COUNT`
189
+ - `LIFETIME_SESSION_COUNT`
190
+ - `AFFISE_DEEPLINK`
191
+ - `AFFISE_PART_PARAM_NAME`
192
+ - `AFFISE_PART_PARAM_NAME_TOKEN`
193
+ - `AFFISE_APP_TOKEN`
194
+ - `LABEL`
195
+ - `AFFISE_SDK_SECRET_ID`
196
+ - `UUID`
197
+ - `AFFISE_APP_OPENED`
198
+ - `PUSHTOKEN`
199
+ - `EVENTS`
200
+ - `AFFISE_EVENTS_COUNT`
201
+
202
+ ### Events tracking
203
+
204
+ For example, we want to track what items usually user adds to shopping cart. To send event first create it with
205
+ following code
206
+
207
+ ```typescript
208
+ import {Affise, AddToCartEvent} from 'affise-attribution-lib';
209
+
210
+
211
+ class Presenter {
212
+ onUserAddsItemsToCart(item: string) {
213
+ const items = {
214
+ items: "cookies, potato, milk",
215
+ };
216
+
217
+ Affise.sendEvent(
218
+ AddToCartEvent(
219
+ items,
220
+ Date.now(),
221
+ "groceries"
222
+ )
223
+ );
224
+ }
225
+ }
226
+ ```
227
+
228
+ With above example you can implement other events:
229
+
230
+ - `AchieveLevelEvent`
231
+ - `AddPaymentInfoEvent`
232
+ - `AddToCartEvent`
233
+ - `AddToWishlistEvent`
234
+ - `ClickAdvEvent`
235
+ - `CompleteRegistrationEvent`
236
+ - `CompleteStreamEvent`
237
+ - `CompleteTrialEvent`
238
+ - `CompleteTutorialEvent`
239
+ - `ContentItemsViewEvent`
240
+ - `DeepLinkedEvent`
241
+ - `InitiatePurchaseEvent`
242
+ - `InitiateStreamEvent`
243
+ - `InviteEvent`
244
+ - `LastAttributedTouchEvent`
245
+ - `ListViewEvent`
246
+ - `LoginEvent`
247
+ - `OpenedFromPushNotificationEvent`
248
+ - `PurchaseEvent`
249
+ - `RateEvent`
250
+ - `ReEngageEvent`
251
+ - `ReserveEvent`
252
+ - `SearchEvent`
253
+ - `ShareEvent`
254
+ - `SpendCreditsEvent`
255
+ - `StartRegistrationEvent`
256
+ - `StartTrialEvent`
257
+ - `StartTutorialEvent`
258
+ - `SubscribeEvent`
259
+ - `TravelBookingEvent`
260
+ - `UnlockAchievementEvent`
261
+ - `UnsubscribeEvent`
262
+ - `UpdateEvent`
263
+ - `ViewAdvEvent`
264
+ - `ViewCartEvent`
265
+ - `ViewItemEvent`
266
+ - `ViewItemsEvent`
267
+
268
+ ### Custom events tracking
269
+
270
+ Use any of custom events if default doesn't fit your scenario:
271
+
272
+ - `CustomId01Event`
273
+ - `CustomId02Event`
274
+ - `CustomId03Event`
275
+ - `CustomId04Event`
276
+ - `CustomId05Event`
277
+ - `CustomId06Event`
278
+ - `CustomId07Event`
279
+ - `CustomId08Event`
280
+ - `CustomId09Event`
281
+ - `CustomId10Event`
282
+
283
+ ### Predefined event parameters
284
+
285
+ To enrich your event with another dimension, you can use predefined parameters for most common cases.
286
+ Add it to any event:
287
+
288
+ ```typescript
289
+ import {Affise, AddToCartEvent, PredefinedParameters} from 'affise-attribution-lib';
290
+
291
+ class Presenter {
292
+ onUserAddsItemsToCart(item: string) {
293
+ const items = {
294
+ "items": "cookies, potato, milk",
295
+ };
296
+
297
+ const event = AddToCartEvent(
298
+ items,
299
+ Date.now(),
300
+ );
301
+
302
+ event.addPredefinedParameter(PredefinedParameters.DESCRIPTION, "best before 2029");
303
+
304
+ Affise.sendEvent(event);
305
+ }
306
+ }
307
+ ```
308
+
309
+
310
+ In examples above `PredefinedParameters.DESCRIPTION` is used, but many others is available:
311
+ - `ADREV_AD_TYPE`
312
+ - `CITY`
313
+ - `COUNTRY`
314
+ - `REGION`
315
+ - `CLASS`
316
+ - `CONTENT`
317
+ - `CONTENT_ID`
318
+ - `CONTENT_LIST`
319
+ - `CONTENT_TYPE`
320
+ - `CURRENCY`
321
+ - `CUSTOMER_USER_ID`
322
+ - `DATE_A`
323
+ - `DATE_B`
324
+ - `DEPARTING_ARRIVAL_DATE`
325
+ - `DEPARTING_DEPARTURE_DATE`
326
+ - `DESCRIPTION`
327
+ - `DESTINATION_A`
328
+ - `DESTINATION_B`
329
+ - `DESTINATION_LIST`
330
+ - `HOTEL_SCORE`
331
+ - `LEVEL`
332
+ - `MAX_RATING_VALUE`
333
+ - `NUM_ADULTS`
334
+ - `NUM_CHILDREN`
335
+ - `NUM_INFANTS`
336
+ - `ORDER_ID`
337
+ - `PAYMENT_INFO_AVAILABLE`
338
+ - `PREFERRED_NEIGHBORHOODS`
339
+ - `PREFERRED_NUM_STOPS`
340
+ - `PREFERRED_PRICE_RANGE`
341
+ - `PREFERRED_STAR_RATINGS`
342
+ - `PRICE`
343
+ - `PURCHASE_CURRENCY`
344
+ - `QUANTITY`
345
+ - `RATING_VALUE`
346
+ - `RECEIPT_ID`
347
+ - `REGISTRATION_METHOD`
348
+ - `RETURNING_ARRIVAL_DATE`
349
+ - `RETURNING_DEPARTURE_DATE`
350
+ - `REVENUE`
351
+ - `SCORE`
352
+ - `SEARCH_STRING`
353
+ - `SUBSCRIPTION_ID`
354
+ - `SUCCESS`
355
+ - `SUGGESTED_DESTINATIONS`
356
+ - `SUGGESTED_HOTELS`
357
+ - `TRAVEL_START`
358
+ - `TRAVEL_END`
359
+ - `USER_SCORE`
360
+ - `VALIDATED`
361
+ - `ACHIEVEMENT_ID`
362
+ - `COUPON_CODE`
363
+ - `CUSTOMER_SEGMENT`
364
+ - `DEEP_LINK`
365
+ - `EVENT_START`
366
+ - `EVENT_END`
367
+ - `LAT`
368
+ - `LONG`
369
+ - `NEW_VERSION`
370
+ - `OLD_VERSION`
371
+ - `REVIEW_TEXT`
372
+ - `TUTORIAL_ID`
373
+ - `VIRTUAL_CURRENCY_NAME`
374
+ - `PARAM_01`
375
+ - `PARAM_02`
376
+ - `PARAM_03`
377
+ - `PARAM_04`
378
+ - `PARAM_05`
379
+ - `PARAM_06`
380
+ - `PARAM_07`
381
+ - `PARAM_08`
382
+ - `PARAM_09`
383
+
384
+
385
+ ### Events buffering
386
+
387
+ Affise library will send any pending events with first opportunity,
388
+ but if there is no network connection or device is disabled, events are kept locally for 7 days before deletion.
389
+
390
+
391
+ ### Advertising Identifier (google) tracking
392
+
393
+ Advertising Identifier (google) tracking is supported automatically, no actions needed
394
+
395
+ ### Open Advertising Identifier (huawei) tracking
396
+
397
+ Open Advertising Identifier is supported automatically, no actions needed
398
+
399
+ ### Install referrer tracking
400
+
401
+ Install referrer tracking is supported automatically, no actions needed
402
+
403
+ ### Push token tracking
404
+
405
+ To let affise track push token you need to receive it from your push service provider, and pass to Affise library.
406
+ First add firebase integration to your app completing theese steps: https://firebase.google.com/docs/cloud-messaging/android/client
407
+
408
+ After you have done with firebase inegration, add to your cloud messaging service `onNewToken` method `Affise.addPushToken(token)`
409
+
410
+ ```typescript
411
+ import {Affise} from 'affise-attribution-lib';
412
+ import messaging from '@react-native-firebase/messaging';
413
+
414
+ const getToken = async () => {
415
+ const token = await messaging().getToken();
416
+ if (token) {
417
+ Affise.addPushToken(token);
418
+ }
419
+ }
420
+ ```
421
+
422
+ ### Reinstall Uninstall tracking
423
+
424
+ Affise automatically track reinstall events by using silent-push technology, to make this feature work, pass push token when it is recreated by user and on you application starts up
425
+ ```typescript
426
+ Affise.addPushToken(token);
427
+ ```
428
+
429
+ ### APK preinstall tracking
430
+
431
+ SDK is also supports scenario when APK is installed not from one of application markets, such as google play, huawei appgallery or amazon appstore
432
+ To use this feature, create file with name `partner_key` in your app assets directory, and write unique identifier inside, this key will be passed to our backend so you can track events by partner later in your Affise console.
433
+
434
+ ### Deeplinks
435
+
436
+ - register applink callback right after Affise.init(..)
437
+
438
+ ```typescript
439
+ Affise.registerDeeplinkCallback((uri) => {
440
+
441
+ });
442
+
443
+ ```
444
+
445
+ #### Android
446
+
447
+ To integrate applink support in android you need:
448
+
449
+ - add intent filter to one of your activities, replacing YOUR_AFFISE_APP_ID with id from your affise personal cabinet
450
+
451
+ ```xml
452
+ <intent-filter android:autoVerify="true">
453
+ <action android:name="android.intent.action.VIEW" />
454
+ <category android:name="android.intent.category.DEFAULT" />
455
+ <category android:name="android.intent.category.BROWSABLE" />
456
+ <data android:scheme="https" />
457
+ <data android:host="YOUR_AFFISE_APP_ID.affattr.com" />
458
+ </intent-filter>
459
+ ```
460
+
461
+
462
+ ### Offline mode
463
+
464
+ In some scenarious you would want to limit Affise network usage, to pause that activity call anywhere in your application following code after Affise init:
465
+
466
+ ```typescript
467
+ Affise.init(..);
468
+ Affise.setOfflineModeEnabled(true); // to enable offline mode
469
+ Affise.setOfflineModeEnabled(false); // to disable offline mode
470
+ ```
471
+ While offline mode is enabled, your metrics and other events are kept locally, and will be delivered once offline mode is disabled.
472
+ Offline mode is persistent as Application lifecycle, and will be disabled with process termination automaticly.
473
+ To check current offline mode status call:
474
+
475
+ ```typescript
476
+ Affise.isOfflineModeEnabled(); // returns true or false describing current tracking state
477
+ ```
478
+
479
+ ### Disable tracking
480
+
481
+ To disable any tracking activity, storing events and gathering device identifiers and metrics call anywhere in your application following code after Affise init:
482
+
483
+ ```typescript
484
+ Affise.init(..);
485
+ Affise.setTrackingEnabled(true); // to enable tracking
486
+ Affise.setTrackingEnabled(false); // to disable tracking
487
+ ```
488
+
489
+ By default tracking is enabled.
490
+
491
+ While tracking mode is disabled, metrics and other identifiers is not generated locally.
492
+ Keep in mind that this flag is persistent until app reinstall, and don't forget to reactivate tracking when needed.
493
+ To check current status of tracking call:
494
+
495
+ ```typescript
496
+ Affise.isTrackingEnabled().then(enabled => {
497
+ // returns true or false describing current tracking state
498
+ });
499
+ ```
500
+
501
+ ### Disable background tracking
502
+
503
+ To disable any background tracking activity, storing events and gathering device identifiers and metrics call anywhere in your application following code after Affise init:
504
+
505
+ ```typescript
506
+ Affise.init(..);
507
+ Affise.setBackgroundTrackingEnabled(true); // to enable background tracking
508
+ Affise.setBackgroundTrackingEnabled(false); // to disable background tracking
509
+ ```
510
+
511
+ By default background tracking is enabled.
512
+
513
+ While background tracking mode is disabled, metrics and other identifiers is not generated locally.
514
+ Background tracking mode is persistent as Application lifecycle, and will be re-enabled with process termination automatically.
515
+ To check current status of background tracking call:
516
+
517
+ ```typescript
518
+ Affise.isBackgroundTrackingEnabled().then(enabled => {
519
+ // returns true or false describing current background tracking state
520
+ });
521
+ ```
522
+
523
+ ### GDPR right to be forgotten
524
+
525
+ Under the EU's General Data Protection Regulation (GDPR): An individual has the right to have their personal data erased.
526
+ To provide this functionality to user, as the app developer, you can call
527
+
528
+ ```typescript
529
+ Affise.init(..);
530
+ Affise.forget(); // to forget users data
531
+ ```
532
+ After processing such request our backend servers will delete all users data.
533
+ To prevent library from generating new events, disable tracking just before calling Affise.forget:
534
+
535
+ ```typescript
536
+ Affise.init(..);
537
+ Affise.setTrackingEnabled(false);
538
+ Affise.forget(); // to forget users data
539
+ ```
540
+
541
+ ### Get referrer
542
+
543
+ Use the next public method of SDK
544
+
545
+ ```typescript
546
+ Affise.getReferrer().then(referrer => {
547
+ // returns referrer
548
+ });
549
+ ```
@@ -0,0 +1,37 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "affise-attribution-native"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => "11.0" }
15
+ s.source = { :git => "https://github.com/affise/sdk-react.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
18
+
19
+ s.dependency "React-Core"
20
+ s.dependency 'AffiseAttributionLib', '~> 1.0.4'
21
+
22
+ # Don't install the dependencies when we run `pod install` in the old architecture.
23
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
24
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
25
+ s.pod_target_xcconfig = {
26
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
27
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
28
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
29
+ }
30
+ s.dependency "React-Codegen"
31
+ s.dependency "RCT-Folly"
32
+ s.dependency "RCTRequired"
33
+ s.dependency "RCTTypeSafety"
34
+ s.dependency "ReactCommon/turbomodule/core"
35
+
36
+ end
37
+ end
@@ -0,0 +1,87 @@
1
+ buildscript {
2
+ // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
+ def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["AffiseAttributionNative_kotlinVersion"]
4
+
5
+ repositories {
6
+ google()
7
+ mavenCentral()
8
+ }
9
+
10
+ dependencies {
11
+ classpath "com.android.tools.build:gradle:7.2.1"
12
+ // noinspection DifferentKotlinGradleVersion
13
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
+ }
15
+ }
16
+
17
+ def isNewArchitectureEnabled() {
18
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
19
+ }
20
+
21
+ apply plugin: "com.android.library"
22
+ apply plugin: "kotlin-android"
23
+
24
+ if (isNewArchitectureEnabled()) {
25
+ apply plugin: "com.facebook.react"
26
+ }
27
+
28
+ def getExtOrDefault(name) {
29
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["AffiseAttributionNative_" + name]
30
+ }
31
+
32
+ def getExtOrIntegerDefault(name) {
33
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["AffiseAttributionNative_" + name]).toInteger()
34
+ }
35
+
36
+ android {
37
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
38
+
39
+ defaultConfig {
40
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
41
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
42
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
43
+ }
44
+ buildTypes {
45
+ release {
46
+ minifyEnabled false
47
+ }
48
+ }
49
+
50
+ lintOptions {
51
+ disable "GradleCompatible"
52
+ }
53
+
54
+ compileOptions {
55
+ sourceCompatibility JavaVersion.VERSION_1_8
56
+ targetCompatibility JavaVersion.VERSION_1_8
57
+ }
58
+
59
+ }
60
+
61
+ repositories {
62
+ mavenCentral()
63
+ google()
64
+ }
65
+
66
+ def kotlin_version = getExtOrDefault("kotlinVersion")
67
+
68
+ dependencies {
69
+ // For < 0.71, this will be from the local maven repo
70
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
71
+ //noinspection GradleDynamicVersion
72
+ implementation "com.facebook.react:react-native"
73
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
74
+
75
+ implementation "com.android.installreferrer:installreferrer:2.2"
76
+
77
+ implementation fileTree(dir: "libs", include: ["attribution-release.aar"])
78
+ implementation fileTree(dir: "libs", include: ["oaid_sdk_1.0.26.aar"])
79
+ }
80
+
81
+ if (isNewArchitectureEnabled()) {
82
+ react {
83
+ jsRootDir = file("../src/")
84
+ libraryName = "AffiseAttributionNative"
85
+ codegenJavaPackageName = "com.affise.attribution.react"
86
+ }
87
+ }
@@ -0,0 +1,5 @@
1
+ AffiseAttributionNative_kotlinVersion=1.7.0
2
+ AffiseAttributionNative_minSdkVersion=21
3
+ AffiseAttributionNative_targetSdkVersion=31
4
+ AffiseAttributionNative_compileSdkVersion=31
5
+ AffiseAttributionNative_ndkversion=21.4.7075529
Binary file
@@ -0,0 +1,4 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.affise.attribution.react">
3
+
4
+ </manifest>