@convivainc/conviva-react-native-appanalytics 0.1.4 → 0.1.5

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 (28) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/README.md +61 -7
  3. package/android/src/main/java/com/conviva/react/apptracker/util/TrackerVersion.java +1 -1
  4. package/ios/RNConvivaAppAnalytics.m +42 -23
  5. package/ios/Util/RNTrackerVersion.m +1 -1
  6. package/package.json +1 -1
  7. package/android/.gradle/7.5/checksums/checksums.lock +0 -0
  8. package/android/.gradle/7.5/checksums/md5-checksums.bin +0 -0
  9. package/android/.gradle/7.5/checksums/sha1-checksums.bin +0 -0
  10. package/android/.gradle/7.5/dependencies-accessors/dependencies-accessors.lock +0 -0
  11. package/android/.gradle/7.5/dependencies-accessors/gc.properties +0 -0
  12. package/android/.gradle/7.5/executionHistory/executionHistory.lock +0 -0
  13. package/android/.gradle/7.5/fileChanges/last-build.bin +0 -0
  14. package/android/.gradle/7.5/fileHashes/fileHashes.bin +0 -0
  15. package/android/.gradle/7.5/fileHashes/fileHashes.lock +0 -0
  16. package/android/.gradle/7.5/fileHashes/resourceHashesCache.bin +0 -0
  17. package/android/.gradle/7.5/gc.properties +0 -0
  18. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  19. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  20. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  21. package/android/.gradle/config.properties +0 -2
  22. package/android/.gradle/vcs-1/gc.properties +0 -0
  23. package/android/.idea/compiler.xml +0 -6
  24. package/android/.idea/gradle.xml +0 -19
  25. package/android/.idea/migrations.xml +0 -10
  26. package/android/.idea/misc.xml +0 -10
  27. package/android/.idea/vcs.xml +0 -6
  28. package/android/local.properties +0 -8
package/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
 
2
2
  # Changelog
3
3
 
4
+ ## 0.1.5 (07/JUN/2024)
5
+ - Supports trackCustomEvent with JSONObject argument for [iOS Bridge](https://github.com/Conviva/conviva-ios-appanalytics)
6
+
4
7
  ## 0.1.4 (05/JAN/2024)
5
8
  - Supports the Auto Detection of ScreenView navigation if the application uses the [NavigationContainer](https://reactnavigation.org/docs/5.x/hello-react-navigation)(for react native version 5 and above) or [AppNavigator](https://reactnavigation.org/docs/4.x/hello-react-navigation)(for react native version below 5)<br>
6
9
  *Note:Please refer to [ScreenView Auto-Detection](https://github.com/Conviva/conviva-react-native-appanalytics?tab=readme-ov-file#auto-detect-screenview-events-for-tracking-screen-navigation) for more details*
package/README.md CHANGED
@@ -10,7 +10,7 @@ npm install @convivainc/conviva-react-native-appanalytics --save
10
10
  npx pod-install
11
11
  ```
12
12
 
13
- ## Android Gradle dependency
13
+ ## Android Native Sensor dependencies
14
14
  Add the following line to app's build.gradle file along with the dependencies:
15
15
  ```
16
16
  dependencies {
@@ -18,6 +18,28 @@ dependencies {
18
18
  implementation 'com.conviva.sdk:conviva-android-tracker:<version>'
19
19
  }
20
20
  ```
21
+ Android Plugin should be used for the auto collection of **Button Click** and **OkHttp/Retrofit/HTTPSUrlConnection/HTTPUrlConnection** **NetworkRequest Tracking** features. The following example shows how to include the plugin:
22
+ ```
23
+ // in the root or project-level build.gradle
24
+ dependencies {
25
+ ...
26
+ // For Android Gradle Plugin version 8.0 and above, use
27
+ classpath 'com.conviva.sdk:android-plugin:0.3.x'
28
+
29
+ // For Android Gradle Plugin version below 8.0, use
30
+ classpath 'com.conviva.sdk:android-plugin:0.2.x'
31
+ ...
32
+ }
33
+
34
+ // in the app, build.gradle at the end of plugins add the
35
+ ...
36
+ apply plugin: 'com.conviva.sdk.android-plugin'
37
+
38
+ // in the app, build.gradle.kts at the end of plugins add the
39
+ plugins {
40
+ id 'com.conviva.sdk.android-plugin'
41
+ }
42
+ ```
21
43
 
22
44
  ## Initialize the tracker
23
45
  ```js
@@ -45,15 +67,31 @@ tracker.setSubjectData({userId: viewerId});
45
67
 
46
68
  ## Report PageView Events for tracking in-app page navigations.
47
69
  ```js
48
- tracker.trackPageViewEvent({pageUrl: string, pageTitle?: string, referrer?: string});
70
+ tracker.trackPageView({pageUrl: string, pageTitle?: string, referrer?: string});
49
71
 
50
72
  let pageViewEvent = {'pageUrl' : 'https://allpopulated.com',
51
73
  'pageTitle' : 'some title',
52
74
  'referrer' : 'http://refr.com'};
53
- tracker.trackPageViewEvent(pageViewEvent);
75
+ tracker.trackPageView(pageViewEvent);
76
+ ```
77
+
78
+ ## Auto detect button clicks.
79
+ Even though the React Native components can be natively mapped in Android and iOS, for the Auto detection of button clicks for **Button**, **TouchableHighlight**, **TouchableOpacity**, **TouchableWithoutFeedback** and **TouchableNativeFeedback** Components, needs explicit addition of babel transfomation. Add below plugin code in your application .babel.rc or babel.config.js file:
80
+
81
+ ```js
82
+
83
+ "plugins": ["./node_modules/@convivainc/conviva-react-native-appanalytics/instrumentation/index.js"]
84
+
54
85
  ```
55
86
 
56
87
  ## Auto detect ScreenView Events for tracking screen navigation.
88
+ To support Conviva to Auto Detect the Screen Name part of the ScreenView Events, add below plugin code in your application .babel.rc or babel.config.js file:
89
+ ```js
90
+
91
+ "plugins": ["add-react-displayname"]
92
+
93
+ ```
94
+
57
95
  For React Navigation versions 5 and above, to autocapture screenviews, wrap withReactNavigationAutotrack(autocaptureNavigationTrack) around the NavigationContainer:
58
96
 
59
97
  ```js
@@ -95,13 +133,14 @@ let App = withReactNavigationAutotrack(autocaptureNavigationTrack)(AppNavigator)
95
133
 
96
134
 
97
135
  ## Custom event tracking to track your application specific events and state changes
136
+ <strong>_*** Note: Supported only in Android right now ***_<br></strong><br>
98
137
  Use trackCustomEvent() API to track all kinds of events. This API provides 2 fields to describe the tracked events.
99
138
 
100
139
  eventName - Name of the custom event. (Mandatory)
101
140
 
102
141
  eventData - Any JSON Object.
103
142
 
104
- The following example shows the implementation of the 'onClick' event listener to any element.
143
+ The following example shows the implementation of the application using these API's:
105
144
  ```js
106
145
  tracker.trackCustomEvent(eventName: string, eventData?: any);
107
146
 
@@ -115,7 +154,7 @@ Use setCustomTags() API to set all kinds of tags (key value pairs). This API pro
115
154
 
116
155
  data - Any JSON Object.
117
156
 
118
- The following example shows the implementation of the 'onClick' event listener to any element.
157
+ The following example shows the implementation of the application using this API:
119
158
 
120
159
  ```js
121
160
  tracker.setCustomTags(customTagsToSet: any);
@@ -128,7 +167,7 @@ Use clearCustomTags() API to remove that are set prior. This API provides 1 argu
128
167
 
129
168
  keys - Array of strings representing tag keys.
130
169
 
131
- The following example shows the implementation of the 'onClick' event listener to any element.
170
+ The following example shows the implementation of the application using this API:
132
171
  ```js
133
172
  tracker.clearCustomTags(tagKeys: string[]);
134
173
 
@@ -138,7 +177,22 @@ tracker.clearCustomTags(customTagKeysToClear);
138
177
 
139
178
  Use clearAllCustomTags() API to remove all the custom tags that are set prior.
140
179
 
141
- The following example shows the implementation of the 'onClick' event listener to any element.
180
+ The following example shows the implementation of the application using this API:
142
181
  ```js
143
182
  tracker.clearAllCustomTags();
144
183
  ```
184
+
185
+ <details>
186
+ <summary><b>Auto-collected Events</b></summary>
187
+
188
+ ##### Conviva provides a rich set of application performance metrics with the help of autocollected app events, such as _screen_view_ , _button_click_, and _network_request_.
189
+
190
+ Event | Occurrence |
191
+ ------|------------ |
192
+ network_request | after receiving the network request response ; auto collected from the Native Sensors, Need android-plugin inclusion for Android|
193
+ screen_view | when the screen is interacted on either first launch or relaunch ; auto collected from the Native Sensors + React Native Screens; Need add-react-displayname plugin and wrapping of Navigation Components |
194
+ application_error | when an error occurrs in the application ; auto collected from the Native Sensors|
195
+ button_click | on the button click callback ; auto collected from the Native Sensors + React Native **Button**, **TouchableHighlight**, **TouchableOpacity**, **TouchableWithoutFeedback** and **TouchableNativeFeedback** Components; Need Conviva index.js from the node_modules folder|
196
+ application_background | when the application is taken to the background ; auto collected from the Native Sensors|
197
+ application_foreground | when the application is taken to the foreground ; auto collected from the Native Sensors|
198
+ application_install | when the application is launched for the first time after it's installed. (It's not the exact installed time.) |
@@ -4,6 +4,6 @@ import com.conviva.react.apptracker.BuildConfig;
4
4
 
5
5
  public class TrackerVersion {
6
6
 
7
- public final static String RN_CONVIVA_TRACKER_VERSION = "rn-0.1.4";
7
+ public final static String RN_CONVIVA_TRACKER_VERSION = "rn-0.1.5";
8
8
 
9
9
  }
@@ -637,10 +637,10 @@ RCT_EXPORT_METHOD(trackCustomEvent:
637
637
 
638
638
  if (trackerController != nil) {
639
639
  NSString *eventName = [details objectForKey:@"eventName"];
640
- NSString *eventData = [details objectForKey:@"eventData"];
640
+ NSDictionary *eventData = [details objectForKey:@"eventData"];
641
641
 
642
642
  if(0 < eventName.length){
643
- [trackerController trackCustomEvent:eventName data:eventData];
643
+ [trackerController trackCustomEvent:eventName eventData:eventData];
644
644
  }
645
645
 
646
646
  resolve(@YES);
@@ -1011,13 +1011,20 @@ RCT_EXPORT_METHOD(getIsInBackground:
1011
1011
  (NSDictionary *)details
1012
1012
  resolver:(RCTPromiseResolveBlock)resolve
1013
1013
  rejecter:(RCTPromiseRejectBlock)reject) {
1014
- NSString *namespace = [details objectForKey:@"tracker"];
1015
- id<CATTrackerController> trackerController = [self trackerByNamespace:namespace];
1016
-
1017
- if (trackerController != nil) {
1018
- BOOL isInBg = [trackerController.session isInBackground];
1019
- resolve(@(isInBg));
1020
- } else {
1014
+ // NSString *namespace = [details objectForKey:@"tracker"];
1015
+ // id<CATTrackerController> trackerController = [self trackerByNamespace:namespace];
1016
+ //
1017
+ // if (trackerController != nil) {
1018
+ // BOOL isInBg = [trackerController.session isInBackground];
1019
+ // resolve(@(isInBg));
1020
+ // } else {
1021
+ // NSError* error = [NSError errorWithDomain:@"ConvivaAppAnalytics" code:200 userInfo:nil];
1022
+ // reject(@"ERROR", @"tracker with given namespace not found", error);
1023
+ // }
1024
+
1025
+ @try {
1026
+ resolve(@(YES));
1027
+ } @catch (NSException *exception) {
1021
1028
  NSError* error = [NSError errorWithDomain:@"ConvivaAppAnalytics" code:200 userInfo:nil];
1022
1029
  reject(@"ERROR", @"tracker with given namespace not found", error);
1023
1030
  }
@@ -1027,13 +1034,19 @@ RCT_EXPORT_METHOD(getBackgroundIndex:
1027
1034
  (NSDictionary *)details
1028
1035
  resolver:(RCTPromiseResolveBlock)resolve
1029
1036
  rejecter:(RCTPromiseRejectBlock)reject) {
1030
- NSString *namespace = [details objectForKey:@"tracker"];
1031
- id<CATTrackerController> trackerController = [self trackerByNamespace:namespace];
1032
-
1033
- if (trackerController != nil) {
1034
- NSInteger bgIdx = [trackerController.session backgroundIndex];
1035
- resolve(@(bgIdx));
1036
- } else {
1037
+ // NSString *namespace = [details objectForKey:@"tracker"];
1038
+ // id<CATTrackerController> trackerController = [self trackerByNamespace:namespace];
1039
+ //
1040
+ // if (trackerController != nil) {
1041
+ // NSInteger bgIdx = [trackerController.session backgroundIndex];
1042
+ // resolve(@(bgIdx));
1043
+ // } else {
1044
+ // NSError* error = [NSError errorWithDomain:@"ConvivaAppAnalytics" code:200 userInfo:nil];
1045
+ // reject(@"ERROR", @"tracker with given namespace not found", error);
1046
+ // }
1047
+ @try {
1048
+ resolve(@(YES));
1049
+ } @catch (NSException *exception) {
1037
1050
  NSError* error = [NSError errorWithDomain:@"ConvivaAppAnalytics" code:200 userInfo:nil];
1038
1051
  reject(@"ERROR", @"tracker with given namespace not found", error);
1039
1052
  }
@@ -1043,13 +1056,19 @@ RCT_EXPORT_METHOD(getForegroundIndex:
1043
1056
  (NSDictionary *)details
1044
1057
  resolver:(RCTPromiseResolveBlock)resolve
1045
1058
  rejecter:(RCTPromiseRejectBlock)reject) {
1046
- NSString *namespace = [details objectForKey:@"tracker"];
1047
- id<CATTrackerController> trackerController = [self trackerByNamespace:namespace];
1048
-
1049
- if (trackerController != nil) {
1050
- NSInteger fgIdx = [trackerController.session foregroundIndex];
1051
- resolve(@(fgIdx));
1052
- } else {
1059
+ // NSString *namespace = [details objectForKey:@"tracker"];
1060
+ // id<CATTrackerController> trackerController = [self trackerByNamespace:namespace];
1061
+ //
1062
+ // if (trackerController != nil) {
1063
+ // NSInteger fgIdx = [trackerController.session foregroundIndex];
1064
+ // resolve(@(fgIdx));
1065
+ // } else {
1066
+ // NSError* error = [NSError errorWithDomain:@"ConvivaAppAnalytics" code:200 userInfo:nil];
1067
+ // reject(@"ERROR", @"tracker with given namespace not found", error);
1068
+ // }
1069
+ @try {
1070
+ resolve(@(YES));
1071
+ } @catch (NSException *exception) {
1053
1072
  NSError* error = [NSError errorWithDomain:@"ConvivaAppAnalytics" code:200 userInfo:nil];
1054
1073
  reject(@"ERROR", @"tracker with given namespace not found", error);
1055
1074
  }
@@ -22,6 +22,6 @@
22
22
 
23
23
  @implementation RNTrackerVersion
24
24
 
25
- NSString * const kRNTrackerVersion = @"rn-0.1.4";
25
+ NSString * const kRNTrackerVersion = @"rn-0.1.5";
26
26
 
27
27
  @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@convivainc/conviva-react-native-appanalytics",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Conviva React Native Application Analytics Library",
5
5
  "main": "conviva-react-native-appanalytics.js",
6
6
  "repository": {
File without changes
@@ -1,2 +0,0 @@
1
- #Mon Dec 18 17:16:15 IST 2023
2
- gradle.version=7.5
@@ -1,2 +0,0 @@
1
- #Mon Dec 18 17:16:12 IST 2023
2
- java.home=/private/var/folders/k4/74893875541dtbxdz44z6zbr0000gn/T/AppTranslocation/4A54960E-0028-414A-AF27-0F092C67D374/d/Android Studio.app/Contents/jbr/Contents/Home
File without changes
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="CompilerConfiguration">
4
- <bytecodeTargetLevel target="11" />
5
- </component>
6
- </project>
@@ -1,19 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="GradleMigrationSettings" migrationVersion="1" />
4
- <component name="GradleSettings">
5
- <option name="linkedExternalProjectsSettings">
6
- <GradleProjectSettings>
7
- <option name="testRunner" value="GRADLE" />
8
- <option name="externalProjectPath" value="$PROJECT_DIR$" />
9
- <option name="gradleJvm" value="Embedded JDK" />
10
- <option name="modules">
11
- <set>
12
- <option value="$PROJECT_DIR$" />
13
- </set>
14
- </option>
15
- <option name="resolveExternalAnnotations" value="false" />
16
- </GradleProjectSettings>
17
- </option>
18
- </component>
19
- </project>
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectMigrations">
4
- <option name="MigrateToGradleLocalJavaHome">
5
- <set>
6
- <option value="$PROJECT_DIR$" />
7
- </set>
8
- </option>
9
- </component>
10
- </project>
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ExternalStorageConfigurationManager" enabled="true" />
4
- <component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
5
- <output url="file://$PROJECT_DIR$/build/classes" />
6
- </component>
7
- <component name="ProjectType">
8
- <option name="id" value="Android" />
9
- </component>
10
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
- </component>
6
- </project>
@@ -1,8 +0,0 @@
1
- ## This file must *NOT* be checked into Version Control Systems,
2
- # as it contains information specific to your local configuration.
3
- #
4
- # Location of the SDK. This is only used by Gradle.
5
- # For customization when using a Version Control System, please read the
6
- # header note.
7
- #Mon Dec 18 17:16:12 IST 2023
8
- sdk.dir=/Users/sramachandra/Library/Android/sdk