diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..895c127 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog +All notable changes to this widget will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## 3.3.6 - 2021-06-18 + +### Changed +- Fixed the widget throwing errors and crashing the page while having ads blocker or tracking option disabled in the browser. + +## Older releases +See [marketplace](https://marketplace.mendix.com/link/component/105) for previous releases. diff --git a/package-lock.json b/package-lock.json index 7f03f39..6be473b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,15 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "ansi-colors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", + "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", + "dev": true, + "requires": { + "ansi-wrap": "^0.1.0" + } + }, "ansi-cyan": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", @@ -131,9 +140,9 @@ "dev": true }, "atob": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", - "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, "balanced-match": { @@ -336,12 +345,61 @@ "integrity": "sha1-KY1+IjFmD0DAA8LtMUDezz9TCF8=", "dev": true }, + "clone-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", + "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", + "dev": true + }, "clone-stats": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", "dev": true }, + "cloneable-readable": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.3.tgz", + "integrity": "sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -1118,14 +1176,82 @@ } }, "gulp-json-transform": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/gulp-json-transform/-/gulp-json-transform-0.4.5.tgz", - "integrity": "sha512-kaGUaAhgjxeLgIMNF3IPFFmYCF6AgvzBQwqmVowiIStNADZSoILtPNDisYA4mKfpwMTqSiWLogQt1q5U75+uwA==", + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/gulp-json-transform/-/gulp-json-transform-0.4.7.tgz", + "integrity": "sha512-Wi0p5GpoLXbTDwaZnw6rgj3FMLW3PscaHaX1okxrTgPWeqnIiMo4aJz7VlG68JYkxPeAXJrPce8AGEfcT2IifA==", "dev": true, "requires": { - "gulp-util": "^3.0.8", + "ansi-colors": "^1.0.1", + "fancy-log": "^1.3.2", + "plugin-error": "^1.0.1", "promise": "^8.0.1", - "through2": "^2.0.3" + "through2": "^2.0.3", + "vinyl": "^2.1.0" + }, + "dependencies": { + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-stats": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "plugin-error": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", + "integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==", + "dev": true, + "requires": { + "ansi-colors": "^1.0.1", + "arr-diff": "^4.0.0", + "arr-union": "^3.1.0", + "extend-shallow": "^3.0.2" + } + }, + "replace-ext": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.1.tgz", + "integrity": "sha512-yD5BHCe7quCgBph4rMQ+0KkIRKwWCrHDOX1p1Gp6HwjPM5kVoCdKGNhN7ydqqsX6lJEnQDKZ/tFMiEdQ1dvPEw==", + "dev": true + }, + "vinyl": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz", + "integrity": "sha512-LII3bXRFBZLlezoG5FfZVcXflZgWP/4dCwKtxd5ky9+LOtM4CS3bIRQsmR1KMnMW07jpE8fqR2lcxPZ+8sJIcw==", + "dev": true, + "requires": { + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" + } + } } }, "gulp-match": { @@ -1264,9 +1390,9 @@ } }, "hosted-git-info": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true }, "inflight": { @@ -1286,9 +1412,9 @@ "dev": true }, "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, "interpret": { @@ -1510,9 +1636,9 @@ "dev": true }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, "lazy-cache": { @@ -1823,9 +1949,9 @@ } }, "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, "mixin-deep": { @@ -1850,20 +1976,12 @@ } }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "dev": true, "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } + "minimist": "^1.2.5" } }, "ms": { @@ -2297,12 +2415,12 @@ "dev": true }, "promise": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/promise/-/promise-8.0.1.tgz", - "integrity": "sha1-5F1osAoXZHttpxG/he1u1HII9FA=", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/promise/-/promise-8.1.0.tgz", + "integrity": "sha512-W04AqnILOL/sPRXziNicCjSNRruLAuIHEOVBazepu0545DDNGYHz7ar9ZgZ1fMU8/MA4mVxp5rkBWRi6OXIy3Q==", "dev": true, "requires": { - "asap": "~2.0.3" + "asap": "~2.0.6" } }, "read-pkg": { @@ -2356,6 +2474,12 @@ "extend-shallow": "^2.0.1" } }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, "repeat-element": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", @@ -2460,9 +2584,9 @@ } }, "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -3032,29 +3156,15 @@ "dev": true }, "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "dev": true, "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } + "set-value": "^2.0.1" } }, "unique-stream": { @@ -3367,9 +3477,9 @@ "dev": true }, "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", "dev": true }, "yargs": { diff --git a/package.json b/package.json index c3ae483..e945ec8 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "gulp": "^3.9.1", "gulp-if": "^2.0.1", "gulp-intercept": "^0.1.0", - "gulp-json-transform": "^0.4.2", + "gulp-json-transform": "^0.4.7", "gulp-newer": "^1.3.0", "gulp-util": "^3.0.7", "gulp-zip": "^3.2.0", diff --git a/src/GoogleAnalytics/widget/AdvancedPageTracker.js b/src/GoogleAnalytics/widget/AdvancedPageTracker.js index cc533e4..e17e999 100644 --- a/src/GoogleAnalytics/widget/AdvancedPageTracker.js +++ b/src/GoogleAnalytics/widget/AdvancedPageTracker.js @@ -45,7 +45,9 @@ define("GoogleAnalytics/widget/AdvancedPageTracker", [ for (var i = 0; i < this.metricDimensionList.length; i++) { var dimension = this.metricDimensionList[i]; if (dimension.name.indexOf("dimension") === 0) { - ga("set", dimension.name, this._contextObj.get(dimension.attr)); + if (this._gaScriptAvailable()) { + ga("set", dimension.name, this._contextObj.get(dimension.attr)); + } } } callback(); @@ -55,13 +57,15 @@ define("GoogleAnalytics/widget/AdvancedPageTracker", [ logger.debug(this.id + "._addPage"); this._replaceTags(this.trackUrl, lang.hitch(this, function (newTrackUrl) { this._replaceTags(this.pageTitle, lang.hitch(this, function (newPageTitle) { - this._setDimensions(function () { - ga("send", { - hitType: "pageview", - page: newTrackUrl, - title: newPageTitle - }); - }); + this._setDimensions(lang.hitch(this, function () { + if (this._gaScriptAvailable()) { + ga("send", { + hitType: "pageview", + page: newTrackUrl, + title: newPageTitle + }); + } + })); })); }) ); diff --git a/src/GoogleAnalytics/widget/EventTracker.js b/src/GoogleAnalytics/widget/EventTracker.js index 09a30b3..7d5bd7a 100644 --- a/src/GoogleAnalytics/widget/EventTracker.js +++ b/src/GoogleAnalytics/widget/EventTracker.js @@ -18,12 +18,14 @@ define("GoogleAnalytics/widget/EventTracker", [ _addEvent: function () { logger.debug(this.id + "._addEvent"); - ga("send", - "event", - this.category, - this.action, - (this._contextObj !== null) ? this._contextObj.get(this.label) : "", - (this._contextObj !== null) ? this._contextObj.get(this.value) : ""); + if (this._gaScriptAvailable()) { + ga("send", + "event", + this.category, + this.action, + (this._contextObj !== null) ? this._contextObj.get(this.label) : "", + (this._contextObj !== null) ? this._contextObj.get(this.value) : ""); + } } }); diff --git a/src/GoogleAnalytics/widget/EventTrackerButton.js b/src/GoogleAnalytics/widget/EventTrackerButton.js index 4fcf240..156adbe 100644 --- a/src/GoogleAnalytics/widget/EventTrackerButton.js +++ b/src/GoogleAnalytics/widget/EventTrackerButton.js @@ -28,7 +28,7 @@ define("GoogleAnalytics/widget/EventTrackerButton", [ _addEvent: function () { logger.debug(this.id + "._addEvent"); - if (this.addEvent) { + if (this.addEvent && this._gaScriptAvailable()) { ga("send", "event", this.category, diff --git a/src/GoogleAnalytics/widget/MasterPageTracker.js b/src/GoogleAnalytics/widget/MasterPageTracker.js index dda001c..8512bb2 100644 --- a/src/GoogleAnalytics/widget/MasterPageTracker.js +++ b/src/GoogleAnalytics/widget/MasterPageTracker.js @@ -65,24 +65,28 @@ define("GoogleAnalytics/widget/MasterPageTracker", [ logger.debug(this.id + "._insertGoogleAnalytics"); this._addGoogle(window, document, "script", "https://www.google-analytics.com/analytics.js", "ga"); - if (typeof window.mxGoogleAnalytics === "undefined") { - this._replaceTags(this.uaTrackCode, lang.hitch(this, function (text) { - var opts = { "cookieDomain": "auto" }; + if (this._gaScriptAvailable()) { + if (typeof window.mxGoogleAnalytics === "undefined") { + this._replaceTags(this.uaTrackCode, lang.hitch(this, function(text) { + var opts = { "cookieDomain": "auto" }; - if (this.useridAttr !== "") { - var uid = this._contextObj.get(this.useridAttr); - opts.userId = uid; - ga("create", text, opts); - ga("set", "&uid", uid); + if (this.useridAttr !== "") { + var uid = this._contextObj.get(this.useridAttr); + opts.userId = uid; + ga("create", text, opts); + ga("set", "&uid", uid); - if (this.userIdDimension > 0) - ga("set", "dimension"+this.userIdDimension, uid); + if (this.userIdDimension > 0) + ga("set", "dimension" + this.userIdDimension, uid); - } else { - ga("create", text, opts); - } + } else { + ga("create", text, opts); + } - })); + })); + } + } else { + logger.warn("Google Analytics script could not be loaded, please check if you dont have an ads blocker extension or tracking feature disabled."); } }, _buildFullPath: function(prefix, includePageName, oriMendixPath) { @@ -98,11 +102,13 @@ define("GoogleAnalytics/widget/MasterPageTracker", [ logger.debug(this.id + "._addPage"); this._replaceTags(this.prefix, lang.hitch(this, function(text) { var path = this._buildFullPath(text, this.includePageName, this.mxform.path); - ga("send", { - "hitType": "pageview", - "page": path, - "title": this.mxform.title - }); + if (this._gaScriptAvailable()) { + ga("send", { + "hitType": "pageview", + "page": path, + "title": this.mxform.title + }); + } })); } }); diff --git a/src/GoogleAnalytics/widget/PageTracker.js b/src/GoogleAnalytics/widget/PageTracker.js index 94ef6ff..0080bd7 100644 --- a/src/GoogleAnalytics/widget/PageTracker.js +++ b/src/GoogleAnalytics/widget/PageTracker.js @@ -20,11 +20,13 @@ define("GoogleAnalytics/widget/PageTracker", [ _addPage: function () { logger.debug(this.id + "._addPage"); - ga("send", { - "hitType": "pageview", - "page": this.trackUrl, - "title": this.pageTitle - }); + if (this._gaScriptAvailable()) { + ga("send", { + "hitType": "pageview", + "page": this.trackUrl, + "title": this.pageTitle + }); + } } }); diff --git a/src/GoogleAnalytics/widget/TrackerCore.js b/src/GoogleAnalytics/widget/TrackerCore.js index 3db4ca6..ecdd0bc 100644 --- a/src/GoogleAnalytics/widget/TrackerCore.js +++ b/src/GoogleAnalytics/widget/TrackerCore.js @@ -42,11 +42,19 @@ define([ logger.debug(this.id + ".TrackerCore._insertGoogleAnalytics"); this._addGoogle(window, document, "script", "https://www.google-analytics.com/analytics.js", "ga"); - if (typeof window.mxGoogleAnalytics === "undefined") { - ga("create", this.uaTrackCode, "auto"); + if (this._gaScriptAvailable()) { + if (typeof window.mxGoogleAnalytics === "undefined") { + ga("create", this.uaTrackCode, "auto"); + } + + ga("set", "checkProtocolTask", null); + } else { + logger.warn("Google Analytics script could not be loaded, please check if you dont have an ads blocker extension or tracking feature disabled."); } + }, - ga("set", "checkProtocolTask", null); + _gaScriptAvailable: function () { + return typeof ga !== "undefined"; }, }); diff --git a/src/package.xml b/src/package.xml index 135bb6a..4bda98b 100644 --- a/src/package.xml +++ b/src/package.xml @@ -1,6 +1,6 @@ - + @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/test/widgets/GoogleAnalytics.mpk b/test/widgets/GoogleAnalytics.mpk index 744e856..783a8c8 100644 Binary files a/test/widgets/GoogleAnalytics.mpk and b/test/widgets/GoogleAnalytics.mpk differ