@aicore/core-analytics-client-lib 1.0.9 → 1.0.10
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 +5 -6
- package/dist/analytics.min.js +3 -3
- package/dist/analytics.min.js.map +1 -1
- package/package.json +1 -1
- package/src/analytics.js +6 -8
package/README.md
CHANGED
|
@@ -118,7 +118,6 @@ during the `initAnalyticsSession` call. `initAnalyticsSession()` takes the follo
|
|
|
118
118
|
* `granularitySec` (_Optional_): The smallest time period under which the events can be distinguished. Multiple
|
|
119
119
|
events happening during this time period is aggregated to a count. The default granularity is 3 Seconds or server controlled,
|
|
120
120
|
which means that any events that happen within 3 seconds cannot be distinguished in ordering.
|
|
121
|
-
* `debug` (_Optional_): set to true if you want to see detailed debug logs.
|
|
122
121
|
|
|
123
122
|
#### usageExample
|
|
124
123
|
```javascript
|
|
@@ -139,12 +138,12 @@ initAnalyticsSession("accountID", "appName", "https://localhost:3000", 600, 5);
|
|
|
139
138
|
### Debug logs
|
|
140
139
|
If you want to see detailed logs on what is happening inside analytics lib, use the below code:
|
|
141
140
|
```js
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
initAnalyticsSession("accountID", "appName"
|
|
141
|
+
// Just before initAnalyticsSession call, set or unset window.analytics.debugMode
|
|
142
|
+
window.analytics.debugMode = true;
|
|
143
|
+
initAnalyticsSession("accountID", "appName");
|
|
145
144
|
```
|
|
146
145
|
|
|
147
|
-
To see info level logs that shows actual analytics data being sent to server, set the below property:
|
|
146
|
+
To see info level logs that shows actual analytics data being sent to server, set or unset the below property:
|
|
148
147
|
```js
|
|
149
148
|
window.analytics.debugInfoLogsEnable = true;
|
|
150
149
|
```
|
|
@@ -159,7 +158,7 @@ Since this is a pure JS template project, build command just runs test with cove
|
|
|
159
158
|
|
|
160
159
|
# Before raising a pull request, run release script and add the generated
|
|
161
160
|
# minified files in dist folder to commits .
|
|
162
|
-
# WARNING!!!: If the minified files are not
|
|
161
|
+
# WARNING!!!: If the minified files are not checked in git push will fail.
|
|
163
162
|
> npm run release
|
|
164
163
|
```
|
|
165
164
|
|
package/dist/analytics.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function initAnalyticsSession(e,t,n,
|
|
2
|
-
typically means that you may be sending too many value events? .`),U("Sending Analytics data of length: ",n.length,"B"),e=["Sending data:",n],
|
|
3
|
-
postIntervalSeconds:${
|
|
1
|
+
function initAnalyticsSession(e,t,n,o,a){let i,r,s,l,u,c,d,f,y={};const g="aicore.analytics.userID",v="aicore.analytics.sessionID",p=1e4;let m=null;var w,h,b,C="undefined"==typeof window;let I="https://analytics.core.ai",S,D,E=0,T=!1;function U(...e){window.analytics.debugMode&&console.log("analytics client: ",...e)}function A(...e){window.analytics.debugMode&&console.error("analytics client: ",...e)}if(C)throw new Error("Node environment is not currently supported");function N(){return{schemaVersion:1,accountID:i,appName:r,uuid:s,sessionID:l,unixTimestampUTC:+new Date,numEventsTotal:0,events:{}}}function $(){if(!m)throw new Error("Please call initSession before using any analytics event")}function k(e){e.backoffCount=(e.backoffCount||0)+1,U(`Failed to call core analytics server. Will retry in ${30*e.backoffCount}s: `),setTimeout(()=>{L(e)},3e4*e.backoffCount)}function B(t){var e,n=JSON.stringify(t);n.length>p&&console.warn(`Analytics event generated is very large at greater than ${n.length}B. This
|
|
2
|
+
typically means that you may be sending too many value events? .`),U("Sending Analytics data of length: ",n.length,"B"),e=["Sending data:",n],window.analytics.debugMode&&window.analytics.debugInfoLogsEnable&&console.info("analytics client: ",...e),window.navigator.onLine?window.fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>{200!==e.status&&(400!==e.status?k(t):console.error("Bad Request, this is most likely a problem with the library, update to latest version."))}).catch(e=>{A(e),k(t)}):k(t)}function L(e){T||(e||(e=m,E=0,R(),m=N()),0!==e.numEventsTotal&&B(e))}function R(e){S&&(clearInterval(S),S=null),e||(S=setInterval(()=>{E+=c},1e3*c))}function M(e){R(e),D&&(clearInterval(D),D=null),e||(D=setInterval(L,1e3*u))}function _(n,o,a,i=1,r=0){if(!T){var s=n,l=o,u=a,c=i,d=r;if($(),!s||!l||!u)throw new Error("missing eventType or category or subCategory");if("number"!=typeof c||c<0)throw new Error("invalid count, count should be a positive number");if("number"!=typeof d)throw new Error("invalid value, value should be a number");{s=n;l=o;u=a;let e=m.events;e[s]=e[s]||{},e[s][l]=e[s][l]||{},e[s][l][u]=e[s][l][u]||{time:[],valueCount:[]}}let t=m.events;c=t[n][o][a].time;if((0<c.length?c[c.length-1]:null)===E){d=t[n][o][a].valueCount.length-1;{var s=d,l=n,u=o,c=a,d=i,f=r;let t=m.events;var e="number"==typeof t[l][u][c].valueCount[s];if(e&&0===f)t[l][u][c].valueCount[s]+=d;else if(e&&0!==f){let e={};e[f]=d,e[0]=t[l][u][c].valueCount[s],t[l][u][c].valueCount[s]=e}else if(!e){let e=t[l][u][c].valueCount[s];e[f]=(e[f]||0)+d}m.numEventsTotal+=1}}else{if(t[n][o][a].time.push(E),0===r)t[n][o][a].valueCount.push(i);else{let e={};e[r]=i,t[n][o][a].valueCount.push(e)}m.numEventsTotal+=1}}}if(!e||!t)throw new Error("accountID and appName must exist for init");d=n?n.toString().replace(/\/$/,""):I,i=e,r=t,u=o||60,c=a||3,f=d+"/ingest",s=function(){let e=localStorage.getItem(g);return e||(e=crypto.randomUUID(),localStorage.setItem(g,e)),e}(),l=function(){let e=sessionStorage.getItem(v);return e||(e=Math.random().toString(36).substr(2,10),sessionStorage.setItem(v,e)),e}(),m=N(),M(),w=o,h=a,new Promise(t=>{var e;window.navigator.onLine?(e=d+(`/getAppConfig?accountID=${i}&appName=`+r),window.fetch(e).then(e=>{switch(e.status){case 200:return void e.json().then(e=>{t(e)}).catch(e=>{A("remote response invalid. Continuing with defaults.",e),t({})});case 400:A("Bad Request, check library version compatible?",e),t({});break;default:A("Could not update from remote config. Continuing with defaults.",e),t({})}}).catch(e=>{A("Could not update from remote config. Continuing with defaults.",e),t({})})):t({})}).then(e=>{y!=={}&&(y=e,u=w||y.postIntervalSecondsInit||60,c=h||y.granularitySecInit||3,d=y.analyticsURLInit||d||I,M(T=!0===y.disabled),U(`Init analytics Config from remote. disabled: ${T}
|
|
3
|
+
postIntervalSeconds:${u}, granularitySec: ${c} ,URL: `+d),T&&console.warn(`Core Analytics is disabled from the server for app: ${i}:`+r))});for(b of analytics._initData)_(...b);analytics._initData=[],analytics._getCurrentAnalyticsEvent=function(){return $(),JSON.parse(JSON.stringify(m))},analytics._getAppConfig=function(){return{accountID:i,appName:r,disabled:T,uuid:s,sessionID:l,postIntervalSeconds:u,granularitySec:c,analyticsURL:d,serverConfig:y}},analytics.event=_}window.analytics||(window.analytics={_initData:[],debugMode:!1}),void 0===window.crypto&&(window.crypto={}),"randomUUID"in crypto||(crypto.randomUUID=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))});
|
|
4
4
|
//# sourceMappingURL=analytics.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"src/analytics.js","sources":["src/analytics.js"],"names":["initAnalyticsSession","accountIDInit","appNameInit","analyticsURLInit","postIntervalSecondsInit","granularitySecInit","
|
|
1
|
+
{"version":3,"sourceRoot":"src/analytics.js","sources":["src/analytics.js"],"names":["initAnalyticsSession","accountIDInit","appNameInit","analyticsURLInit","postIntervalSecondsInit","granularitySecInit","let","accountID","appName","userID","sessionID","postIntervalSeconds","granularitySec","analyticsURL","postURL","serverConfig","USERID_LOCAL_STORAGE_KEY","SESSION_ID_LOCAL_STORAGE_KEY","POST_LARGE_DATA_THRESHOLD_BYTES","currentAnalyticsEvent","postIntervalSecondsInitial","granularitySecInitial","eventData","IS_NODE_ENV","window","DEFAULT_BASE_URL","granularityTimer","postTimer","currentQuantisedTime","disabled","debugLog","args","analytics","debugMode","console","log","debugError","error","Error","_createAnalyticsEvent","schemaVersion","uuid","unixTimestampUTC","Date","numEventsTotal","events","_validateCurrentState","_retryPost","eventToSend","backoffCount","setTimeout","_postCurrentAnalyticsEvent","DEFAULT_RETRY_TIME_IN_SECONDS","_postEventWithRetry","textToSend","JSON","stringify","length","warn","debugInfo","debugInfoLogsEnable","info","navigator","onLine","fetch","method","headers","Content-Type","body","then","res","status","catch","_resetGranularityTimer","disable","clearInterval","setInterval","_setupTimers","event","eventType","eventCategory","subCategory","eventCount","eventValue","_validateEvent","category","count","value","_ensureAnalyticsEventExists","time","valueCount","timeArray","modificationIndex","_updateExistingAnalyticsEvent","index","newValue","storedValueIsCount","newValueCount","storedValueObject","push","toString","replace","localUserID","localStorage","getItem","crypto","randomUUID","setItem","_getOrCreateUserID","localSessionID","sessionStorage","Math","random","substr","_getOrCreateSessionID","Promise","configURL","json","serverResponse","resolve","err","updatedServerConfig","_initData","_getCurrentAnalyticsEvent","parse","_getAppConfig","c","getRandomValues","Uint8Array"],"mappings":"AAwCA,SAASA,qBAAqBC,EAAeC,EAAaC,EACtDC,EAAyBC,GACzBC,IAAIC,EAAWC,EAASC,EAAQC,EAAWC,EACvCC,EAAgBC,EAAcC,EAASC,EAAa,GACxD,MAGMC,EAA2B,0BAC3BC,EAA+B,6BAC/BC,EAAkC,IACxCZ,IAAIa,EAAwB,KAC5B,IAkN+BC,EAA4BC,EAwHnDC,EA1UFC,EAAiC,oBAAXC,OAC5BlB,IAAImB,EAAmB,4BAEnBC,EACAC,EACAC,EAAuB,EACvBC,GAAW,EAEf,SAASC,KAAYC,GACbP,OAAOQ,UAAUC,WAGrBC,QAAQC,IAAI,wBAAyBJ,GASzC,SAASK,KAAcL,GACfP,OAAOQ,UAAUC,WAGrBC,QAAQG,MAAM,wBAAyBN,GAI3C,GAAGR,EACC,MAAM,IAAIe,MAAM,+CAGpB,SAASC,IACL,MAAO,CACHC,cAAe,EACfjC,UAAWA,EACXC,QAASA,EACTiC,KAAMhC,EACNC,UAAWA,EACXgC,kBAAmB,IAAIC,KAC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BAAgB,IAAIC,WAAW,IAAI,GAAK,IAAMF,EAAI,GAAG1B,SAAS"}
|
package/package.json
CHANGED
package/src/analytics.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
if(!window.analytics){
|
|
8
8
|
window.analytics = {
|
|
9
|
-
_initData: []
|
|
9
|
+
_initData: [],
|
|
10
|
+
debugMode: false
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -36,10 +37,9 @@ if (!('randomUUID' in crypto)){
|
|
|
36
37
|
* @param granularitySecInit Optional: The smallest time period under which the events can be distinguished. Multiple
|
|
37
38
|
* events happening during this time period is aggregated to a count. The default granularity is 3 Seconds or server
|
|
38
39
|
* controlled, which means that any events that happen within 3 seconds cannot be distinguished in ordering.
|
|
39
|
-
* @param debug set to true if you want to see detailed debug logs.
|
|
40
40
|
*/
|
|
41
41
|
function initAnalyticsSession(accountIDInit, appNameInit, analyticsURLInit,
|
|
42
|
-
postIntervalSecondsInit, granularitySecInit
|
|
42
|
+
postIntervalSecondsInit, granularitySecInit) {
|
|
43
43
|
let accountID, appName, userID, sessionID, postIntervalSeconds,
|
|
44
44
|
granularitySec, analyticsURL, postURL, serverConfig={};
|
|
45
45
|
const DEFAULT_GRANULARITY_IN_SECONDS = 3;
|
|
@@ -56,23 +56,22 @@ function initAnalyticsSession(accountIDInit, appNameInit, analyticsURLInit,
|
|
|
56
56
|
let postTimer;
|
|
57
57
|
let currentQuantisedTime = 0;
|
|
58
58
|
let disabled = false;
|
|
59
|
-
let debugMode = false;
|
|
60
59
|
|
|
61
60
|
function debugLog(...args) {
|
|
62
|
-
if(!debugMode){
|
|
61
|
+
if(!window.analytics.debugMode){
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
65
64
|
console.log("analytics client: ", ...args);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
function debugInfo(...args) {
|
|
69
|
-
if(debugMode && window.analytics.debugInfoLogsEnable){
|
|
68
|
+
if(window.analytics.debugMode && window.analytics.debugInfoLogsEnable){
|
|
70
69
|
console.info("analytics client: ", ...args);
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
function debugError(...args) {
|
|
75
|
-
if(!debugMode){
|
|
74
|
+
if(!window.analytics.debugMode){
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
77
|
console.error("analytics client: ", ...args);
|
|
@@ -368,7 +367,6 @@ function initAnalyticsSession(accountIDInit, appNameInit, analyticsURLInit,
|
|
|
368
367
|
analyticsURL = analyticsURLInit? _stripTrailingSlash(analyticsURLInit) : DEFAULT_BASE_URL;
|
|
369
368
|
accountID = accountIDInit;
|
|
370
369
|
appName = appNameInit;
|
|
371
|
-
debugMode = debug || false;
|
|
372
370
|
postIntervalSeconds = postIntervalSecondsInit || DEFAULT_POST_INTERVAL_SECONDS;
|
|
373
371
|
granularitySec = granularitySecInit || DEFAULT_GRANULARITY_IN_SECONDS;
|
|
374
372
|
postURL = analyticsURL + "/ingest";
|