Skip to content

Commit d1c5090

Browse files
committed
fix: use new core analytics lib apis
1 parent 58fae1c commit d1c5090

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/utils/Metrics.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ define(function (require, exports, module) {
141141
// for core analytics
142142
if(!window.analytics){ window.analytics = {
143143
_initData: [], loadStartTime: new Date().getTime(),
144-
event: function (){window.analytics._initData.push(arguments);}
144+
event: function (){window.analytics._initData.push(arguments);},
145+
countEvent: function(t,c,s,n){window.analytics._initData.push([t,c,s,n||1,0]);},
146+
valueEvent: function(t,c,s,v,n){window.analytics._initData.push([t,c,s,n||1,v||0]);}
145147
};}
146148
// for google analytics
147149
if(!Phoenix.isNativeApp) {
@@ -275,8 +277,8 @@ define(function (require, exports, module) {
275277
brackets.config.coreAnalyticsAppNameDesktop:
276278
brackets.config.coreAnalyticsAppName;
277279
window.initAnalyticsSession( brackets.config.coreAnalyticsID, appName);
278-
window.analytics.event("core-analytics", "client-lib", "loadTime", 1,
279-
(new Date().getTime())- window.analytics.loadStartTime);
280+
window.analytics.valueEvent("core-analytics", "client-lib", "loadTime",
281+
(new Date().getTime())- window.analytics.loadStartTime, 1);
280282
};
281283
script.src = 'https://unpkg.com/@aicore/core-analytics-client-lib/dist/analytics.min.js';
282284
document.getElementsByTagName('head')[0].appendChild(script);
@@ -360,10 +362,11 @@ define(function (require, exports, module) {
360362
if(!label){
361363
label = action;
362364
}
363-
if(!value){
364-
value = 1;
365+
if(value){
366+
analytics.valueEvent(category, action, label, value, count || 1);
367+
} else {
368+
analytics.countEvent(category, action, label, count || 1);
365369
}
366-
analytics.event(category, action, label, count, value);
367370
}
368371

369372
const AUDIT_TYPE_COUNT = "count",

0 commit comments

Comments
 (0)