@cronapp/framework-analytics-google 3.2.1 → 4.0.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cronapp/framework-analytics-google",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "npx webpack --progress --config webpack.config.js",
|
|
6
6
|
"watch": "npx webpack -d eval-source-map --progress --watch --config webpack.config.js",
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@analytics/google-analytics": "0.5.2",
|
|
12
|
-
"@cronapp/framework-analytics": "
|
|
12
|
+
"@cronapp/framework-analytics": "4.0.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@types/angular": "1.8.1"
|
|
15
|
+
"@types/angular": "1.8.1",
|
|
16
|
+
"ts-loader": "9.5.1"
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e=
|
|
1
|
+
(()=>{var e={};(()=>{"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(t){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{},o=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(a).filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable})))),o.forEach((function(n){e(t,n,a[n])}))}return t}var n={trackingId:null,debug:!1,anonymizeIp:!1,customDimensions:{},resetCustomDimensionsOnPage:[],setCustomDimensionsToPage:!0},a={};function o(e){return e?!function(e){var t=document.querySelectorAll("script[src]");return!!Object.keys(t).filter((function(n){return(t[n].src||"")===e})).length}(e):"undefined"==typeof ga}function i(e){var t=e.instanceName;return{instancePrefix:t?"".concat(t,"."):"",instanceName:t}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={},n=e.name,a=e.source,o=e.medium,i=e.content,r=e.keyword;return n&&(t.campaignName=n),a&&(t.campaignSource=a),o&&(t.campaignMedium=o),i&&(t.campaignContent=i),r&&(t.campaignKeyword=r),t}function c(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).customDimensions;return Object.keys(t).reduce((function(n,a){var o=t[a],i=function(e,t,n,a,o){for(t=t.split?t.split("."):t,a=0;a<t.length;a++)e=e?e[t[a]]:o;return e===o?void 0:e}(e,a)||e[a];return"boolean"==typeof i&&(i=i.toString()),i||0===i?(n[o]=i,n):n}),{})}function s(){var e=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0,n=c(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e);return Object.keys(n).length?e.setCustomDimensionsToPage?(ga("".concat(t,"set"),n),{}):n:{}}const l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=!1,u=i(e),f=u.instanceName,g=u.instancePrefix;return{name:"google-analytics",config:t({},n,e),initialize:function(e){var n=e.config,i=e.instance;if(!n.trackingId)throw new Error("No GA trackingId defined");var r=n.customScriptSrc||"https://www.google-analytics.com/analytics.js";if(o(r)&&function(e,t,n,a,o,i,r){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,i=t.createElement(n),r=t.getElementsByTagName(n)[0],i.async=1,i.src=a,r.parentNode.insertBefore(i,r)}(window,document,"script",r,"ga"),!a[f]){var s=t({cookieDomain:n.domain||"auto",siteSpeedSampleRate:n.siteSpeedSampleRate||1,sampleRate:n.sampleRate||100,allowLinker:!0},n.cookieConfig);f&&(s.name=f),ga("create",n.trackingId,s),n.debug&&(ga("".concat(g,"set"),"sendHitTask",null),window.ga_debug={trace:!0}),n.anonymizeIp&&ga("".concat(g,"set"),"anonymizeIp",!0),n.tasks&&["customTask","previewTask","checkProtocolTask","validationTask","checkStorageTask","historyImportTask","samplerTask","buildHitTask","sendHitTask","timingTask","displayFeaturesTask"].forEach((function(e){if(n.tasks.hasOwnProperty(e)){var t=n.tasks[e];"function"==typeof t?ga(n.tasks[e]):null===t&&ga("".concat(g,"set"),e,t)}}));var l=(i.user()||{}).traits||{};if(Object.keys(l).length){var u=c(l,n);ga("".concat(g,"set"),u)}a[f]=!0}},page:function(e){var n=e.payload,a=e.config,i=e.instance,c=n.properties,u=a.resetCustomDimensionsOnPage,f=a.customDimensions,p=i.getState("context.campaign");if(!o()){if(u&&u.length){var d=u.reduce((function(e,t){return f[t]&&(e[f[t]]=null),e}),{});Object.keys(d).length&&ga("".concat(g,"set"),d)}var v=c.path||document.location.pathname,m={page:v,title:c.title,location:c.url},y={page:v,title:c.title};c.referrer!==document.referrer&&(y.referrer=c.referrer);var h=t({},m,r(p),s(c,a,g));ga("".concat(g,"set"),y),l&&delete h.location,ga("".concat(g,"send"),"pageview",h),l=!0}},track:function(e){var n=e.payload,a=e.config,c=e.instance,l=n.properties,u=n.event,f=l.label,g=l.value;!function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;if(!o()){var c,l=i(n).instancePrefix,u={hitType:e.hitType||"event",eventAction:e.event,eventLabel:e.label,eventCategory:e.category||"All",nonInteraction:void 0!==e.nonInteraction&&!!e.nonInteraction};e.value&&(u.eventValue=!(c=e.value)||c<0?0:Math.round(c));var f=t({},u,r(e),s(a.properties,n,l));ga("".concat(l,"send"),"event",f)}}({hitType:"event",event:u,label:f,category:l.category||"All",value:g,nonInteraction:l.nonInteraction,campaign:c.getState("context.campaign")},a,n)},identify:function(e){var t=e.payload,n=e.config;!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!o()){var a=i(n).instancePrefix;if(e&&ga("".concat(a,"set"),"userId",e),Object.keys(t).length){var r=c(t,n);ga("".concat(a,"set"),r)}}}(t.userId,t.traits,n)},loaded:function(){return!!window.gaplugins}}};var u=cronapp.configuration.IConfigurationService,f=cronapp.ioc.component,g=cronapp.ioc.qualifier,p=cronapp.ioc.bindSingleton,d=cronapp.analytics.IAnalyticsPluginFactory;let v=class{constructor(e){this.configurationService=e}createAnalyticsPlugin(){return e=this,t=void 0,a=function*(){const e=yield this.configurationService.getValue("cronapp.framework.analytics.google.trackingId");return l({trackingId:e})},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{s(a.next(e))}catch(e){i(e)}}function c(e){try{s(a.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}s((a=a.apply(e,t||[])).next())}));var e,t,n,a}};var m,y;v=function(e,t,n,a){var o,i=arguments.length,r=i<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,a);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(r=(i<3?o(r):i>3?o(t,n,r):o(t,n))||r);return i>3&&r&&Object.defineProperty(t,n,r),r}([f(),(m=0,y=g(u),function(e,t){y(e,t,m)}),function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}("design:paramtypes",[Object])],v),p(d,v)})();var t=cronapp="undefined"==typeof cronapp?{}:cronapp;for(var n in e)t[n]=e[n];e.__esModule&&Object.defineProperty(t,"__esModule",{value:!0})})();
|