react-native-quicktracking-analytics-module 1.0.2 → 1.0.3

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 CHANGED
@@ -56,7 +56,7 @@ allprojects {
56
56
  dependencies {
57
57
  implementation fileTree(include:['*.jar'], dir:'libs')
58
58
 
59
- implementation "com.umeng.umsdk:qt-px-common:1.3.9.PX"
59
+ implementation "com.umeng.umsdk:qt-px-common:1.4.0.PX"
60
60
  }
61
61
  ```
62
62
 
@@ -375,6 +375,24 @@ QT.onPageEnd('MainPage');
375
375
  注意:
376
376
  onPageStart 和 onPageEnd 必须成对调用。
377
377
 
378
+ ## 页面属性上传
379
+ 给当前页面附加自定义属性
380
+ ```typescript
381
+ function uploadPageProperties(pageName: string, params: any): void
382
+ ```
383
+ | 参数 | 含义 |
384
+ | --- | --- |
385
+ | pageName | 页面编码 |
386
+ | params | 对当前事件的参数描述,定义为“参数名:参数值”的“<键-值>”对 |
387
+
388
+ 示例:
389
+ ```typescript
390
+ QT.uploadPageProperties('detail_page', { test: 1 })
391
+ ```
392
+ 注意:
393
+ 该接口必须在onPageStart和onPageEnd之间调用
394
+
395
+
378
396
  ## 自定义事件埋点
379
397
  自定义事件可以用于追踪用户行为,记录行为发生的具体细节。
380
398
  使用 **sendEvent **接口进行事件的统计,接口如下:
@@ -512,9 +530,6 @@ export default function WebPage() {
512
530
  }
513
531
  ```
514
532
  # FAQ
515
- ## Umeng4Plus为空
516
- 控制台提示[APLUS] -- jsbridge Android environment error, Umeng4Aplus = undefined
517
- Umeng4Plus是桥接的环境变量,若提示undefined,说明在原生端未接入桥接功能,请找负责Android或iOS的同学对接。
518
533
  ## ruby版本过低
519
534
  进入项目时提示,Required ruby-2.7.5 is not installed. To install do: 'rvm install "ruby-2.7.5"'
520
535
  注意您的ruby版本,MacOS自带的Ruby为2.6.8,不符合RN项目需求。
@@ -134,7 +134,7 @@ dependencies {
134
134
  // implementation fileTree(include:['*.jar'], dir:'libs')
135
135
  implementation "com.facebook.react:react-native:+"
136
136
  //友盟基础库
137
- implementation "com.umeng.umsdk:qt-px-common:1.3.9.PX"
137
+ implementation "com.umeng.umsdk:qt-px-common:1.4.0.PX"
138
138
  }
139
139
 
140
140
  if (isNewArchitectureEnabled()) {
@@ -55,6 +55,27 @@ public class QuicktrackingAnalyticsModuleModule extends ReactContextBaseJavaModu
55
55
  QtTrackAgent.onPageEnd(pageName);
56
56
  }
57
57
 
58
+ @ReactMethod
59
+ public void uploadPageProperties(String pageName, ReadableMap property) {
60
+ Map<String, Object> map = new HashMap();
61
+ ReadableMapKeySetIterator iterator = property.keySetIterator();
62
+ while (iterator.hasNextKey()) {
63
+ String key = iterator.nextKey();
64
+ if (ReadableType.Array == property.getType(key)) {
65
+ map.put(key, property.getArray(key).toString());
66
+ } else if (ReadableType.Boolean == property.getType(key)) {
67
+ map.put(key, String.valueOf(property.getBoolean(key)));
68
+ } else if (ReadableType.Number == property.getType(key)) {
69
+ map.put(key, String.valueOf(property.getInt(key)));
70
+ } else if (ReadableType.String == property.getType(key)) {
71
+ map.put(key, property.getString(key));
72
+ } else if (ReadableType.Map == property.getType(key)) {
73
+ map.put(key, property.getMap(key).toString());
74
+ }
75
+ }
76
+ QtTrackAgent.setPageProperty(context, pageName, map);
77
+ }
78
+
58
79
  @ReactMethod
59
80
  public void onEvent(String eventID) {
60
81
  QtTrackAgent.onEvent(context, eventID);
@@ -1,6 +1,7 @@
1
1
  //#if __has_include(<QTCommon/MobClick.h>)
2
2
  #import <QTCommon/MobClick.h>
3
3
  #import <QTCommon/UMConfigure.h>
4
+ #import <QTCommon/UMSpm.h>
4
5
 
5
6
  //#else
6
7
  //#import "MobClick.h"
@@ -34,6 +35,18 @@ RCT_EXPORT_METHOD(onPageEnd:(NSString *)pageName)
34
35
  [QTMobClick endLogPageView:pageName];
35
36
  }
36
37
 
38
+ // 上传页面属性
39
+ RCT_EXPORT_METHOD(upLoadPageProperties:(NSString *)pageName params:(NSDictionary*)parameters)
40
+ {
41
+ if (pageName == nil || [pageName isKindOfClass:[NSNull class]]) {
42
+ return;
43
+ }
44
+ if (parameters == nil && [parameters isKindOfClass:[NSNull class]]) {
45
+ parameters = nil;
46
+ }
47
+ [UMSpm updatePageProperties:pageName properties: parameters];
48
+ }
49
+
37
50
  //======================================自定义事件相关===========================================//
38
51
  /**
39
52
  * @description QtAnalytics.onEventObject(String eventId, Object params)
@@ -26,6 +26,15 @@ class QT {
26
26
  QuicktrackingAnalyticsModule.onPageEnd(pageName);
27
27
  }
28
28
 
29
+ /**
30
+ * 上传页面属性
31
+ * @param pageName 页面编码
32
+ * @param params 对当前事件的参数描述,定义为“参数名:参数值”的“<键-值>”对
33
+ */
34
+ static uploadPageProperties(pageName, params) {
35
+ QuicktrackingAnalyticsModule.uploadPageProperties(pageName, params);
36
+ }
37
+
29
38
  /**
30
39
  * 自定义事件埋点
31
40
  * @param eventId 当前统计的事件编码
@@ -20,6 +20,15 @@ export class QT {
20
20
  QuicktrackingAnalyticsModule.onPageEnd(pageName);
21
21
  }
22
22
 
23
+ /**
24
+ * 上传页面属性
25
+ * @param pageName 页面编码
26
+ * @param params 对当前事件的参数描述,定义为“参数名:参数值”的“<键-值>”对
27
+ */
28
+ static uploadPageProperties(pageName, params) {
29
+ QuicktrackingAnalyticsModule.uploadPageProperties(pageName, params);
30
+ }
31
+
23
32
  /**
24
33
  * 自定义事件埋点
25
34
  * @param eventId 当前统计的事件编码
@@ -14,6 +14,12 @@ export declare class QT {
14
14
  * @param pageName 页面编码
15
15
  */
16
16
  static onPageEnd(pageName: string): void;
17
+ /**
18
+ * 上传页面属性
19
+ * @param pageName 页面编码
20
+ * @param params 对当前事件的参数描述,定义为“参数名:参数值”的“<键-值>”对
21
+ */
22
+ static uploadPageProperties(pageName: string, params: EventParams): void;
17
23
  /**
18
24
  * 自定义事件埋点
19
25
  * @param eventId 当前统计的事件编码
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-quicktracking-analytics-module",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "QuickTracking ReactNative SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -28,7 +28,9 @@
28
28
  "typescript": "tsc --noEmit",
29
29
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
30
30
  "prepare": "bob build",
31
- "release": "release-it"
31
+ "release": "release-it",
32
+ "example": "yarn --cwd example",
33
+ "bootstrap": "yarn example && yarn && yarn example pods"
32
34
  },
33
35
  "keywords": [
34
36
  "quicktracking",
@@ -17,8 +17,8 @@ Pod::Spec.new do |s|
17
17
  s.source_files = "ios/**/*.{h,m,mm}"
18
18
 
19
19
  s.dependency "React-Core"
20
- s.dependency "QTCommon", "~> 1.3.8.PX"
21
-
20
+ s.dependency "QTCommon", "~> 1.3.9.PX"
21
+
22
22
  # Don't install the dependencies when we run `pod install` in the old architecture.
23
23
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
24
24
  s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
@@ -32,6 +32,6 @@ Pod::Spec.new do |s|
32
32
  s.dependency "RCTRequired"
33
33
  s.dependency "RCTTypeSafety"
34
34
  s.dependency "ReactCommon/turbomodule/core"
35
-
35
+
36
36
  end
37
37
  end
package/src/index.tsx CHANGED
@@ -24,6 +24,15 @@ export class QT {
24
24
  QuicktrackingAnalyticsModule.onPageEnd(pageName);
25
25
  }
26
26
 
27
+ /**
28
+ * 上传页面属性
29
+ * @param pageName 页面编码
30
+ * @param params 对当前事件的参数描述,定义为“参数名:参数值”的“<键-值>”对
31
+ */
32
+ static uploadPageProperties(pageName: string, params: EventParams) {
33
+ QuicktrackingAnalyticsModule.uploadPageProperties(pageName, params);
34
+ }
35
+
27
36
  /**
28
37
  * 自定义事件埋点
29
38
  * @param eventId 当前统计的事件编码