@aicore/core-analytics-client-lib 2.0.2 → 2.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 +9 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,8 +28,10 @@ in the `initAnalyticsSession` call below:
|
|
|
28
28
|
onload="analyticsLibLoaded()"></script>
|
|
29
29
|
<script>
|
|
30
30
|
if(!window.analytics){ window.analytics = {
|
|
31
|
-
_initData
|
|
32
|
-
event: function (){window.analytics._initData.push(arguments);}
|
|
31
|
+
_initData: [], loadStartTime: new Date().getTime(),
|
|
32
|
+
event: function (){window.analytics._initData.push(arguments);},
|
|
33
|
+
countEvent: function(t,c,s,n){window.analytics._initData.push([t,c,s,n||1,0]);},
|
|
34
|
+
valueEvent: function(t,c,s,v,n){window.analytics._initData.push([t,c,s,n||1,v||0]);}
|
|
33
35
|
};}
|
|
34
36
|
function analyticsLibLoaded() {
|
|
35
37
|
initAnalyticsSession('your_analytics_account_ID', 'appName');
|
|
@@ -39,8 +41,8 @@ in the `initAnalyticsSession` call below:
|
|
|
39
41
|
```
|
|
40
42
|
This will create a global `analytics` variable which can be used to access the analytics APIs.
|
|
41
43
|
|
|
42
|
-
NB: The script is loaded async, so it will not block other js scripts. `analytics.
|
|
43
|
-
after the above code and need not wait for the script load to complete.
|
|
44
|
+
NB: The script is loaded async, so it will not block other js scripts. `analytics.countEvent` and `analytics.valueEvent`
|
|
45
|
+
APIs can be called anytime after the above code and need not wait for the script load to complete.
|
|
44
46
|
|
|
45
47
|
## Raising analytics events
|
|
46
48
|
Events are aggregated and sent to the analytics server periodically.
|
|
@@ -107,7 +109,9 @@ function _initCoreAnalytics() {
|
|
|
107
109
|
// Load core analytics scripts
|
|
108
110
|
if(!window.analytics){ window.analytics = {
|
|
109
111
|
_initData: [], loadStartTime: new Date().getTime(),
|
|
110
|
-
event: function (){window.analytics._initData.push(arguments);}
|
|
112
|
+
event: function (){window.analytics._initData.push(arguments);},
|
|
113
|
+
countEvent: function(t,c,s,n){window.analytics._initData.push([t,c,s,n||1,0]);},
|
|
114
|
+
valueEvent: function(t,c,s,v,n){window.analytics._initData.push([t,c,s,n||1,v||0]);}
|
|
111
115
|
};}
|
|
112
116
|
let script = document.createElement('script');
|
|
113
117
|
script.type = 'text/javascript';
|
package/package.json
CHANGED