diff --git a/dist/vue-gtm.min.js b/dist/vue-gtm.min.js index c3d919e..3f80305 100644 --- a/dist/vue-gtm.min.js +++ b/dist/vue-gtm.min.js @@ -1 +1 @@ -module.exports=function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={enabled:!0,debug:!1,trackOnNextTick:!1}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.hasScript=t.loadScript=t.logDebug=void 0;var r=n(0),o=a(r);t.logDebug=function(e){if(o.default.debug){var t;(t=console).log.apply(t,["VueGtm :"].concat(Array.prototype.slice.call(arguments)))}},t.loadScript=function(e){var t=window,n=document,a=n.createElement("script"),r="dataLayer";t[r]=t[r]||[],t[r].push({event:"gtm.js","gtm.start":(new Date).getTime()}),a.async=!0,a.src="https://www.googletagmanager.com/gtm.js?id="+e,n.body.appendChild(a)},t.hasScript=function(){return Array.from(document.getElementsByName("script")).some(function(e){return e.src.includes("googletagmanager")})}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};t=r({},i.default,t),i.default.id=t.id,i.default.debug=t.debug,i.default.enabled=t.enabled,t.vueRouter&&f(e,t),e.prototype.$gtm=e.gtm=new c.default,i.default.enabled&&(0,o.loadScript)(t.id)},f=function(e,t){var n=t.vueRouter,a=t.ignoredViews,r=t.trackOnNextTick;return a&&(a=a.map(function(e){return e.toLowerCase()})),n.afterEach(function(t){if(!a||a.indexOf(t.name.toLowerCase())===-1){var n=t.meta.gtm||t.name;r?e.nextTick(function(){e.gtm.trackView(n,t.fullPath)}):e.gtm.trackView(n,t.fullPath)}}),a};t.default={install:d}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=e.event,n=void 0===t?null:t,a=e.category,o=void 0===a?null:a,i=e.action,c=void 0===i?null:i,s=e.label,v=void 0===s?null:s,p=e.value,g=void 0===p?null:p,b=e.noninteraction,y=void 0!==b&&b,w=r(e,["event","category","action","label","value","noninteraction"]);if(f&&d.default.enabled){(0,l.logDebug)("Dispatching event",u({event:n,category:o,action:c,label:v,value:g},w));var m=window.dataLayer=window.dataLayer||[];m.push(u({event:n||"interaction",target:o,action:c,"target-properties":v,value:g,"interaction-type":y},w))}}}]),e}();t.default=s},function(e,t,n){e.exports=n(2)}]); \ No newline at end of file +module.exports=function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={enabled:!0,debug:!1,trackOnNextTick:!1}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.hasScript=t.loadScript=t.logDebug=void 0;var r=n(0),o=a(r);t.logDebug=function(e){if(o.default.debug){var t;(t=console).log.apply(t,["VueGtm :"].concat(Array.prototype.slice.call(arguments)))}},t.loadScript=function(e){var t=window,n=document,a=n.createElement("script"),r="dataLayer";t[r]=t[r]||[],t[r].push({event:"gtm.js","gtm.start":(new Date).getTime()}),e&&(a.async=!0,a.src="https://www.googletagmanager.com/gtm.js?id="+e,n.body.appendChild(a))},t.hasScript=function(){return Array.from(document.getElementsByTagName("script")).some(function(e){return e.src.includes("googletagmanager")})}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};t=r({},i.default,t),i.default.id=t.id,i.default.debug=t.debug,i.default.enabled=t.enabled,t.vueRouter&&f(e,t),e.prototype.$gtm=e.gtm=new c.default,i.default.enabled&&(0,o.loadScript)(t.id)},f=function(e,t){var n=t.vueRouter,a=t.ignoredViews,r=t.trackOnNextTick;return a&&(a=a.map(function(e){return e.toLowerCase()})),n.afterEach(function(t){if(t.name&&(!a||a.indexOf(t.name.toLowerCase())===-1)){var n=t.meta.gtm||t.name;r?e.nextTick(function(){e.gtm.trackView(n,t.fullPath)}):e.gtm.trackView(n,t.fullPath)}}),a};t.default={install:d}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=e.event,n=void 0===t?null:t,a=e.category,o=void 0===a?null:a,i=e.action,c=void 0===i?null:i,s=e.label,v=void 0===s?null:s,p=e.value,g=void 0===p?null:p,b=e.noninteraction,y=void 0!==b&&b,m=r(e,["event","category","action","label","value","noninteraction"]);if(f&&d.default.enabled){(0,l.logDebug)("Dispatching event",u({event:n,category:o,action:c,label:v,value:g},m));var w=window.dataLayer=window.dataLayer||[];w.push(u({event:n||"interaction",target:o,action:c,"target-properties":v,value:g,"interaction-type":y},m))}}}]),e}();t.default=s},function(e,t,n){e.exports=n(2)}]); \ No newline at end of file diff --git a/package.json b/package.json index 98fd685..275d452 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-gtm", - "version": "2.0.0", + "version": "2.0.1", "description": "Google Tag Manager implementation in Vue application", "main": "./dist/vue-gtm.min.js", "author": "Manish Kumar", diff --git a/src/utils.js b/src/utils.js index 63e247a..cd30c6e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -43,6 +43,6 @@ export const loadScript = function (id) { */ export const hasScript = function () { return Array - .from(document.getElementsByName('script')) + .from(document.getElementsByTagName('script')) .some(script => script.src.includes('googletagmanager')) }