diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-10-01 02:13:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 02:13:01 +0300 |
commit | 261f2f0d4a2c79d8d55c122edb00295d9d1f7efa (patch) | |
tree | 099acedf9aafdb5a24b9ad788fa1b3ee62490f9e /js | |
parent | 00a1698423010dbf22c80c943e383193e34a2bc3 (diff) |
Make JS tracker work in strict mode (#16498)
* Make JS tracker work in strict mode
fix https://github.com/matomo-org/matomo/issues/14791
* rebuilt piwik.js
Diffstat (limited to 'js')
-rw-r--r-- | js/piwik.js | 8 | ||||
-rw-r--r-- | js/piwik.min.js | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/js/piwik.js b/js/piwik.js index b6b16b20e5..bf18d318ef 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -7241,9 +7241,9 @@ if (typeof window.Matomo !== 'object') { /*jslint sloppy: true */ (function () { - var jsTrackerType = (typeof AnalyticsTracker); + var jsTrackerType = (typeof window.AnalyticsTracker); if (jsTrackerType === 'undefined') { - AnalyticsTracker = window.Matomo; + window.AnalyticsTracker = window.Matomo; } }()); /*jslint sloppy: false */ @@ -7269,8 +7269,8 @@ if (typeof window.Matomo !== 'object') { * @param string matomoUrl * @param mixed customData */ -if (typeof piwik_log !== 'function') { - piwik_log = function (documentTitle, siteId, matomoUrl, customData) { +if (typeof window.piwik_log !== 'function') { + window.piwik_log = function (documentTitle, siteId, matomoUrl, customData) { 'use strict'; function getOption(optionName) { diff --git a/js/piwik.min.js b/js/piwik.min.js index 9ddb580479..36bad11f33 100644 --- a/js/piwik.min.js +++ b/js/piwik.min.js @@ -67,6 +67,6 @@ return ao}an(S,"beforeunload",ai,false);an(S,"message",function(au){if(!au||!au. }if((!J(at)||null===at)&&aq){at=aq.getTrackerUrl()}var ap,ao=0;for(ao;ao<I.length;ao++){ap=I[ao];if(ap&&String(ap.getSiteId())===String(ar)&&ap.getTrackerUrl()===at){return ap}}},retryMissedPluginCalls:function(){var ap=ah;ah=[];var ao=0;for(ao;ao<ap.length;ao++){af(ap[ao])}}};if(typeof define==="function"&&define.amd){define("piwik",[],function(){return t});define("matomo",[],function(){return t})}return t}())} /*!!! pluginTrackerHook */ (function(){function b(){if("object"!==typeof _paq){return false}var c=typeof _paq.length;if("undefined"===c){return false}return !!_paq.length}if(window&&"object"===typeof window.matomoPluginAsyncInit&&window.matomoPluginAsyncInit.length){var a=0;for(a;a<window.matomoPluginAsyncInit.length;a++){if(typeof window.matomoPluginAsyncInit[a]==="function"){window.matomoPluginAsyncInit[a]()}}}if(window&&window.piwikAsyncInit){window.piwikAsyncInit()}if(window&&window.matomoAsyncInit){window.matomoAsyncInit()}if(!window.Matomo.getAsyncTrackers().length){if(b()){window.Matomo.addTracker() -}else{_paq={push:function(c){var d=typeof console;if(d!=="undefined"&&console&&console.error){console.error("_paq.push() was used but Matomo tracker was not initialized before the matomo.js file was loaded. Make sure to configure the tracker via _paq.push before loading matomo.js. Alternatively, you can create a tracker via Matomo.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.",c)}}}}}window.Matomo.trigger("MatomoInitialized",[]);window.Matomo.initialized=true}());(function(){var a=(typeof AnalyticsTracker);if(a==="undefined"){AnalyticsTracker=window.Matomo}}());if(typeof piwik_log!=="function"){piwik_log=function(c,e,g,f){function b(h){try{if(window["piwik_"+h]){return window["piwik_"+h]}}catch(i){}return}var d,a=window.Matomo.getTracker(g,e);a.setDocumentTitle(c);a.setCustomData(f);d=b("tracker_pause");if(d){a.setLinkTrackingTimer(d)}d=b("download_extensions");if(d){a.setDownloadExtensions(d)}d=b("hosts_alias"); -if(d){a.setDomains(d)}d=b("ignore_classes");if(d){a.setIgnoreClasses(d)}a.trackPageView();if(b("install_tracker")){piwik_track=function(i,j,k,h){a.setSiteId(j);a.setTrackerUrl(k);a.trackLink(i,h)};a.enableLinkTracking()}}} +}else{_paq={push:function(c){var d=typeof console;if(d!=="undefined"&&console&&console.error){console.error("_paq.push() was used but Matomo tracker was not initialized before the matomo.js file was loaded. Make sure to configure the tracker via _paq.push before loading matomo.js. Alternatively, you can create a tracker via Matomo.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.",c)}}}}}window.Matomo.trigger("MatomoInitialized",[]);window.Matomo.initialized=true}());(function(){var a=(typeof window.AnalyticsTracker);if(a==="undefined"){window.AnalyticsTracker=window.Matomo}}());if(typeof window.piwik_log!=="function"){window.piwik_log=function(c,e,g,f){function b(h){try{if(window["piwik_"+h]){return window["piwik_"+h]}}catch(i){}return}var d,a=window.Matomo.getTracker(g,e);a.setDocumentTitle(c);a.setCustomData(f);d=b("tracker_pause");if(d){a.setLinkTrackingTimer(d)}d=b("download_extensions");if(d){a.setDownloadExtensions(d) +}d=b("hosts_alias");if(d){a.setDomains(d)}d=b("ignore_classes");if(d){a.setIgnoreClasses(d)}a.trackPageView();if(b("install_tracker")){piwik_track=function(i,j,k,h){a.setSiteId(j);a.setTrackerUrl(k);a.trackLink(i,h)};a.enableLinkTracking()}}} /*!! @license-end */;
\ No newline at end of file |