Comparing version 1.7.0 to 1.7.1
@@ -32,2 +32,36 @@ function _typeof(obj) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
var noop = function noop() {}; | ||
@@ -270,3 +304,3 @@ function loadScript(url, domain) { | ||
var trackPage = function trackPage() { | ||
var getPageviewTemplate = function getPageviewTemplate() { | ||
var to = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -302,3 +336,17 @@ var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (pageTrackerScreenviewEnabled && !template.app_name) { | ||
return template; | ||
}; | ||
var trackPage = function trackPage() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
to = _ref.to, | ||
from = _ref.from, | ||
_ref$params = _ref.params, | ||
params = _ref$params === void 0 ? {} : _ref$params; | ||
var _getOptions2 = getOptions(), | ||
pageTrackerScreenviewEnabled = _getOptions2.pageTrackerScreenviewEnabled; | ||
var newParams = _objectSpread2(_objectSpread2({}, getPageviewTemplate(to, from)), params); | ||
if (pageTrackerScreenviewEnabled && !newParams.app_name) { | ||
warn("To use the screenview, add the appName to the plugin options"); | ||
@@ -308,3 +356,3 @@ return; | ||
if (pageTrackerScreenviewEnabled && !template.screen_name) { | ||
if (pageTrackerScreenviewEnabled && !newParams.screen_name) { | ||
warn("To use the screenview, name your routes"); | ||
@@ -315,14 +363,15 @@ return; | ||
if (pageTrackerScreenviewEnabled) { | ||
screenview(template); | ||
screenview(newParams); | ||
return; | ||
} | ||
pageview(template); | ||
pageview(newParams); | ||
}; | ||
var init = function init(Router) { | ||
var startRouter = function startRouter(Router) { | ||
var Vue = getVue(); | ||
var _getOptions2 = getOptions(), | ||
onBeforeTrack = _getOptions2.onBeforeTrack, | ||
onAfterTrack = _getOptions2.onAfterTrack; | ||
var _getOptions3 = getOptions(), | ||
onBeforeTrack = _getOptions3.onBeforeTrack, | ||
onAfterTrack = _getOptions3.onAfterTrack, | ||
config = _getOptions3.config; | ||
/* istanbul ignore next */ | ||
@@ -333,3 +382,6 @@ | ||
Vue.nextTick().then(function () { | ||
trackPage(current); | ||
trackPage({ | ||
to: current, | ||
params: config.params | ||
}); | ||
}); | ||
@@ -339,3 +391,6 @@ Router.afterEach(function (to, from) { | ||
onBeforeTrack(to, from); | ||
trackPage(to, from); | ||
trackPage({ | ||
to: to, | ||
from: from | ||
}); | ||
onAfterTrack(to, from); | ||
@@ -346,3 +401,3 @@ }); | ||
}; | ||
var pageTracker = (function () { | ||
var autotrack = function autotrack() { | ||
var Router = getRouter(); | ||
@@ -354,4 +409,4 @@ | ||
init(Router); | ||
}); | ||
startRouter(Router); | ||
}; | ||
@@ -367,3 +422,3 @@ function _bootstrap () { | ||
globalDataLayerName = _getOptions.globalDataLayerName, | ||
id = _getOptions.config.id, | ||
config = _getOptions.config, | ||
pageTrackerEnabled = _getOptions.pageTrackerEnabled, | ||
@@ -391,5 +446,5 @@ onReady = _getOptions.onReady, | ||
if (isPageTrackerEnabled) { | ||
pageTracker(); | ||
autotrack(); | ||
} else { | ||
config(); | ||
api.config(config.params); | ||
} | ||
@@ -402,3 +457,3 @@ | ||
var domain = "https://www.googletagmanager.com"; | ||
var resource = "".concat(domain, "/gtag/js?id=").concat(id, "&l=").concat(globalDataLayerName); | ||
var resource = "".concat(domain, "/gtag/js?id=").concat(config.id, "&l=").concat(globalDataLayerName); | ||
return loadScript(resource, domain).then(function () { | ||
@@ -405,0 +460,0 @@ var library = window[globalObjectName]; |
@@ -36,2 +36,36 @@ 'use strict'; | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
var noop = function noop() {}; | ||
@@ -274,3 +308,3 @@ function loadScript(url, domain) { | ||
var trackPage = function trackPage() { | ||
var getPageviewTemplate = function getPageviewTemplate() { | ||
var to = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -306,3 +340,17 @@ var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (pageTrackerScreenviewEnabled && !template.app_name) { | ||
return template; | ||
}; | ||
var trackPage = function trackPage() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
to = _ref.to, | ||
from = _ref.from, | ||
_ref$params = _ref.params, | ||
params = _ref$params === void 0 ? {} : _ref$params; | ||
var _getOptions2 = getOptions(), | ||
pageTrackerScreenviewEnabled = _getOptions2.pageTrackerScreenviewEnabled; | ||
var newParams = _objectSpread2(_objectSpread2({}, getPageviewTemplate(to, from)), params); | ||
if (pageTrackerScreenviewEnabled && !newParams.app_name) { | ||
warn("To use the screenview, add the appName to the plugin options"); | ||
@@ -312,3 +360,3 @@ return; | ||
if (pageTrackerScreenviewEnabled && !template.screen_name) { | ||
if (pageTrackerScreenviewEnabled && !newParams.screen_name) { | ||
warn("To use the screenview, name your routes"); | ||
@@ -319,14 +367,15 @@ return; | ||
if (pageTrackerScreenviewEnabled) { | ||
screenview(template); | ||
screenview(newParams); | ||
return; | ||
} | ||
pageview(template); | ||
pageview(newParams); | ||
}; | ||
var init = function init(Router) { | ||
var startRouter = function startRouter(Router) { | ||
var Vue = getVue(); | ||
var _getOptions2 = getOptions(), | ||
onBeforeTrack = _getOptions2.onBeforeTrack, | ||
onAfterTrack = _getOptions2.onAfterTrack; | ||
var _getOptions3 = getOptions(), | ||
onBeforeTrack = _getOptions3.onBeforeTrack, | ||
onAfterTrack = _getOptions3.onAfterTrack, | ||
config = _getOptions3.config; | ||
/* istanbul ignore next */ | ||
@@ -337,3 +386,6 @@ | ||
Vue.nextTick().then(function () { | ||
trackPage(current); | ||
trackPage({ | ||
to: current, | ||
params: config.params | ||
}); | ||
}); | ||
@@ -343,3 +395,6 @@ Router.afterEach(function (to, from) { | ||
onBeforeTrack(to, from); | ||
trackPage(to, from); | ||
trackPage({ | ||
to: to, | ||
from: from | ||
}); | ||
onAfterTrack(to, from); | ||
@@ -350,3 +405,3 @@ }); | ||
}; | ||
var pageTracker = (function () { | ||
var autotrack = function autotrack() { | ||
var Router = getRouter(); | ||
@@ -358,4 +413,4 @@ | ||
init(Router); | ||
}); | ||
startRouter(Router); | ||
}; | ||
@@ -371,3 +426,3 @@ function _bootstrap () { | ||
globalDataLayerName = _getOptions.globalDataLayerName, | ||
id = _getOptions.config.id, | ||
config = _getOptions.config, | ||
pageTrackerEnabled = _getOptions.pageTrackerEnabled, | ||
@@ -395,5 +450,5 @@ onReady = _getOptions.onReady, | ||
if (isPageTrackerEnabled) { | ||
pageTracker(); | ||
autotrack(); | ||
} else { | ||
config(); | ||
api.config(config.params); | ||
} | ||
@@ -406,3 +461,3 @@ | ||
var domain = "https://www.googletagmanager.com"; | ||
var resource = "".concat(domain, "/gtag/js?id=").concat(id, "&l=").concat(globalDataLayerName); | ||
var resource = "".concat(domain, "/gtag/js?id=").concat(config.id, "&l=").concat(globalDataLayerName); | ||
return loadScript(resource, domain).then(function () { | ||
@@ -409,0 +464,0 @@ var library = window[globalObjectName]; |
@@ -38,2 +38,36 @@ (function (global, factory) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
var noop = function noop() {}; | ||
@@ -276,3 +310,3 @@ function loadScript(url, domain) { | ||
var trackPage = function trackPage() { | ||
var getPageviewTemplate = function getPageviewTemplate() { | ||
var to = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -308,3 +342,17 @@ var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (pageTrackerScreenviewEnabled && !template.app_name) { | ||
return template; | ||
}; | ||
var trackPage = function trackPage() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
to = _ref.to, | ||
from = _ref.from, | ||
_ref$params = _ref.params, | ||
params = _ref$params === void 0 ? {} : _ref$params; | ||
var _getOptions2 = getOptions(), | ||
pageTrackerScreenviewEnabled = _getOptions2.pageTrackerScreenviewEnabled; | ||
var newParams = _objectSpread2(_objectSpread2({}, getPageviewTemplate(to, from)), params); | ||
if (pageTrackerScreenviewEnabled && !newParams.app_name) { | ||
warn("To use the screenview, add the appName to the plugin options"); | ||
@@ -314,3 +362,3 @@ return; | ||
if (pageTrackerScreenviewEnabled && !template.screen_name) { | ||
if (pageTrackerScreenviewEnabled && !newParams.screen_name) { | ||
warn("To use the screenview, name your routes"); | ||
@@ -321,14 +369,15 @@ return; | ||
if (pageTrackerScreenviewEnabled) { | ||
screenview(template); | ||
screenview(newParams); | ||
return; | ||
} | ||
pageview(template); | ||
pageview(newParams); | ||
}; | ||
var init = function init(Router) { | ||
var startRouter = function startRouter(Router) { | ||
var Vue = getVue(); | ||
var _getOptions2 = getOptions(), | ||
onBeforeTrack = _getOptions2.onBeforeTrack, | ||
onAfterTrack = _getOptions2.onAfterTrack; | ||
var _getOptions3 = getOptions(), | ||
onBeforeTrack = _getOptions3.onBeforeTrack, | ||
onAfterTrack = _getOptions3.onAfterTrack, | ||
config = _getOptions3.config; | ||
/* istanbul ignore next */ | ||
@@ -339,3 +388,6 @@ | ||
Vue.nextTick().then(function () { | ||
trackPage(current); | ||
trackPage({ | ||
to: current, | ||
params: config.params | ||
}); | ||
}); | ||
@@ -345,3 +397,6 @@ Router.afterEach(function (to, from) { | ||
onBeforeTrack(to, from); | ||
trackPage(to, from); | ||
trackPage({ | ||
to: to, | ||
from: from | ||
}); | ||
onAfterTrack(to, from); | ||
@@ -352,3 +407,3 @@ }); | ||
}; | ||
var pageTracker = (function () { | ||
var autotrack = function autotrack() { | ||
var Router = getRouter(); | ||
@@ -360,4 +415,4 @@ | ||
init(Router); | ||
}); | ||
startRouter(Router); | ||
}; | ||
@@ -373,3 +428,3 @@ function _bootstrap () { | ||
globalDataLayerName = _getOptions.globalDataLayerName, | ||
id = _getOptions.config.id, | ||
config = _getOptions.config, | ||
pageTrackerEnabled = _getOptions.pageTrackerEnabled, | ||
@@ -397,5 +452,5 @@ onReady = _getOptions.onReady, | ||
if (isPageTrackerEnabled) { | ||
pageTracker(); | ||
autotrack(); | ||
} else { | ||
config(); | ||
api.config(config.params); | ||
} | ||
@@ -408,3 +463,3 @@ | ||
var domain = "https://www.googletagmanager.com"; | ||
var resource = "".concat(domain, "/gtag/js?id=").concat(id, "&l=").concat(globalDataLayerName); | ||
var resource = "".concat(domain, "/gtag/js?id=").concat(config.id, "&l=").concat(globalDataLayerName); | ||
return loadScript(resource, domain).then(function () { | ||
@@ -411,0 +466,0 @@ var library = window[globalObjectName]; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).VueGtag={})}(this,function(e){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var o=function(){};function a(e,n){console.warn("[vue-gtag] "+e),n&&n.stack&&console.warn(n.stack)}function r(e){return e&&"object"===n(e)&&!Array.isArray(e)}function i(){var e,n=k().globalObjectName;"undefined"!=typeof window&&(e=window)[n].apply(e,arguments)}var c,u,f=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var o=k(),a=o.config,r=o.includes;i.apply(void 0,["config",a.id].concat(n)),Array.isArray(r)&&r.forEach(function(e){i.apply(void 0,["config",e.id].concat(n))})},p=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=k(),o=t.defaultGroupName,a=t.includes,r=n;a&&null==r.send_to&&(r.send_to=a.map(function(e){return e.id}).concat(o)),i("event",e,r)},l=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var o=n[0],a={};a="string"==typeof o?{page_path:o,page_location:window.location.href}:o,f(a)},d=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];p.apply(void 0,["screen_view"].concat(n))},s=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=k(),t=n.includes,o=n.config;window["ga-disable-".concat(o.id)]=e,Array.isArray(t)&&t.forEach(function(n){window["ga-disable-".concat(n.id)]=e})},g=function(){s(!0)},v={query:i,config:f,event:p,pageview:l,screenview:d,customMap:function(e){f({custom_map:e})},time:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];p.apply(void 0,["timing_complete"].concat(n))},exception:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];p.apply(void 0,["exception"].concat(n))},linker:function(e){f("linker",e)},purchase:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];p.apply(void 0,["purchase"].concat(n))},refund:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];p.apply(void 0,["refund"].concat(n))},set:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];i.apply(void 0,["set"].concat(n))},optIn:function(){s(!1)},optOut:g},y=function(){var e=T();e.$gtag=e.prototype.$gtag=v},w=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.path!==n.path){var t,o=k(),r=o.pageTrackerTemplate,i=o.pageTrackerScreenviewEnabled,c=o.appName,u=r(e,n);t=u||(i?{app_name:c,screen_name:e.name}:{page_title:e.name,page_path:e.path,page_location:window.location.href}),!i||t.app_name?!i||t.screen_name?i?d(t):l(t):a("To use the screenview, name your routes"):a("To use the screenview, add the appName to the plugin options")}},m=function(){var e=_();e&&function(e){var n=T(),t=k(),o=t.onBeforeTrack,a=t.onAfterTrack;e.onReady(function(t){n.nextTick().then(function(){w(t)}),e.afterEach(function(e,t){n.nextTick().then(function(){o(e,t),w(e,t),a(e,t)})})})}(e)};function h(){if("undefined"!=typeof document&&"undefined"!=typeof window){var e=k(),n=e.enabled,t=e.globalObjectName,o=e.globalDataLayerName,r=e.config.id,i=e.pageTrackerEnabled,c=e.onReady,u=e.disableScriptLoad,p=_(),l=Boolean(i&&p);if(n||g(),null==window[t]&&(window[o]=window[o]||[],window[t]=function(){window[o].push(arguments)}),window[t]("js",new Date),l?m():f(),!u){var d="https://www.googletagmanager.com";return function(e,n){return new Promise(function(t,o){var a=document.head||document.getElementsByTagName("head")[0],r=document.createElement("script");if(r.async=!0,r.src=e,r.charset="utf-8",n){var i=document.createElement("link");i.href=n,i.rel="preconnect",a.appendChild(i)}a.appendChild(r),r.onload=t,r.onerror=o})}("".concat(d,"/gtag/js?id=").concat(r,"&l=").concat(o),d).then(function(){var e=window[t];return"function"==typeof c&&c(e),e}).catch(function(e){return a("Ops! Something happened and gtag.js couldn't be loaded",e),e})}}}var b={pageTrackerTemplate:o,onBeforeTrack:o,onAfterTrack:o,onReady:o,enabled:!0,disableScriptLoad:!1,bootstrap:!0,globalObjectName:"gtag",globalDataLayerName:"dataLayer",pageTrackerEnabled:!0,pageTrackerScreenviewEnabled:!1,defaultGroupName:"default",includes:null,config:null},k=function(){return b},A=function(e){return function e(n){for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i<o;i++)a[i-1]=arguments[i];if(!a.length)return n;var c=a.shift();if(r(n)&&r(c)){for(var u in c)r(c[u])?(n[u]||Object.assign(n,t({},u,{})),e(n[u],c[u])):Object.assign(n,t({},u,c[u]));return e.apply(void 0,[n].concat(a))}}(b,e)},T=function(){return c},_=function(){return u};function j(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;c=e,u=t,A(n),y(),b.bootstrap&&h()}var O=h,E=A,N=v.query,S=v.config,x=v.event,L=v.pageview,B=v.screenview,M=v.customMap,q=v.time,D=v.exception,G=v.linker,I=v.purchase,P=v.set,R=v.optIn,C=v.optOut;e.bootstrap=O,e.config=S,e.customMap=M,e.default=j,e.event=x,e.exception=D,e.install=j,e.linker=G,e.optIn=R,e.optOut=C,e.pageview=L,e.purchase=I,e.query=N,e.screenview=B,e.set=P,e.setOptions=E,e.time=q,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).VueGtag={})}(this,function(e){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,o)}return t}function r(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?o(Object(r),!0).forEach(function(n){t(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var a=function(){};function c(e,n){console.warn("[vue-gtag] "+e),n&&n.stack&&console.warn(n.stack)}function i(e){return e&&"object"===n(e)&&!Array.isArray(e)}function u(){var e,n=k().globalObjectName;"undefined"!=typeof window&&(e=window)[n].apply(e,arguments)}var f,p,l=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var o=k(),r=o.config,a=o.includes;u.apply(void 0,["config",r.id].concat(n)),Array.isArray(a)&&a.forEach(function(e){u.apply(void 0,["config",e.id].concat(n))})},d=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=k(),o=t.defaultGroupName,r=t.includes,a=n;r&&null==a.send_to&&(a.send_to=r.map(function(e){return e.id}).concat(o)),u("event",e,a)},s=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var o=n[0],r={};r="string"==typeof o?{page_path:o,page_location:window.location.href}:o,l(r)},g=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];d.apply(void 0,["screen_view"].concat(n))},v=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=k(),t=n.includes,o=n.config;window["ga-disable-".concat(o.id)]=e,Array.isArray(t)&&t.forEach(function(n){window["ga-disable-".concat(n.id)]=e})},y=function(){v(!0)},w={query:u,config:l,event:d,pageview:s,screenview:g,customMap:function(e){l({custom_map:e})},time:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];d.apply(void 0,["timing_complete"].concat(n))},exception:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];d.apply(void 0,["exception"].concat(n))},linker:function(e){l("linker",e)},purchase:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];d.apply(void 0,["purchase"].concat(n))},refund:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];d.apply(void 0,["refund"].concat(n))},set:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];u.apply(void 0,["set"].concat(n))},optIn:function(){v(!1)},optOut:y},m=function(){var e=A();e.$gtag=e.prototype.$gtag=w},h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.to,t=e.from,o=e.params,a=void 0===o?{}:o,i=k().pageTrackerScreenviewEnabled,u=r(r({},function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.path!==n.path){var t=k(),o=t.pageTrackerTemplate,r=t.pageTrackerScreenviewEnabled,a=t.appName,c=o(e,n);return c||(r?{app_name:a,screen_name:e.name}:{page_title:e.name,page_path:e.path,page_location:window.location.href})}}(n,t)),a);!i||u.app_name?!i||u.screen_name?i?g(u):s(u):c("To use the screenview, name your routes"):c("To use the screenview, add the appName to the plugin options")},b=function(){var e=_();e&&function(e){var n=A(),t=k(),o=t.onBeforeTrack,r=t.onAfterTrack,a=t.config;e.onReady(function(t){n.nextTick().then(function(){h({to:t,params:a.params})}),e.afterEach(function(e,t){n.nextTick().then(function(){o(e,t),h({to:e,from:t}),r(e,t)})})})}(e)};function O(){if("undefined"!=typeof document&&"undefined"!=typeof window){var e=k(),n=e.enabled,t=e.globalObjectName,o=e.globalDataLayerName,r=e.config,a=e.pageTrackerEnabled,i=e.onReady,u=e.disableScriptLoad,f=_(),p=Boolean(a&&f);if(n||y(),null==window[t]&&(window[o]=window[o]||[],window[t]=function(){window[o].push(arguments)}),window[t]("js",new Date),p?b():w.config(r.params),!u){var l="https://www.googletagmanager.com";return function(e,n){return new Promise(function(t,o){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("script");if(a.async=!0,a.src=e,a.charset="utf-8",n){var c=document.createElement("link");c.href=n,c.rel="preconnect",r.appendChild(c)}r.appendChild(a),a.onload=t,a.onerror=o})}("".concat(l,"/gtag/js?id=").concat(r.id,"&l=").concat(o),l).then(function(){var e=window[t];return"function"==typeof i&&i(e),e}).catch(function(e){return c("Ops! Something happened and gtag.js couldn't be loaded",e),e})}}}var j={pageTrackerTemplate:a,onBeforeTrack:a,onAfterTrack:a,onReady:a,enabled:!0,disableScriptLoad:!1,bootstrap:!0,globalObjectName:"gtag",globalDataLayerName:"dataLayer",pageTrackerEnabled:!0,pageTrackerScreenviewEnabled:!1,defaultGroupName:"default",includes:null,config:null},k=function(){return j},T=function(e){return function e(n){for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];if(!r.length)return n;var c=r.shift();if(i(n)&&i(c)){for(var u in c)i(c[u])?(n[u]||Object.assign(n,t({},u,{})),e(n[u],c[u])):Object.assign(n,t({},u,c[u]));return e.apply(void 0,[n].concat(r))}}(j,e)},A=function(){return f},_=function(){return p};function E(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;f=e,p=t,T(n),m(),j.bootstrap&&O()}var S=O,P=T,N=w.query,x=w.config,D=w.event,L=w.pageview,B=w.screenview,M=w.customMap,q=w.time,G=w.exception,I=w.linker,R=w.purchase,C=w.set,$=w.optIn,V=w.optOut;e.bootstrap=S,e.config=x,e.customMap=M,e.default=E,e.event=D,e.exception=G,e.install=E,e.linker=I,e.optIn=$,e.optOut=V,e.pageview=L,e.purchase=R,e.query=N,e.screenview=B,e.set=C,e.setOptions=P,e.time=q,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=vue-gtag.umd.min.js.map |
{ | ||
"name": "vue-gtag", | ||
"description": "Global Site Tag (gtag.js) plugin for Vue", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Matteo Gabriele", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76989
1611