Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2020-12-03 22:42:14 +0300
committerGitHub <noreply@github.com>2020-12-03 22:42:14 +0300
commit0d5053c6d0f0f539d8ad460af70ce7cc86420fd0 (patch)
tree15dc3ca7f8a872ad7abf1c7f44b1f26885b15d32 /js/piwik.js
parent8e2d7c590c952568bbfa190b10b967ea33269ad5 (diff)
When forcing GET request method in JS tracker then disable send beacon (#16870)
Diffstat (limited to 'js/piwik.js')
-rw-r--r--js/piwik.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/js/piwik.js b/js/piwik.js
index df8d6776d0..50bfcbda52 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -68,7 +68,7 @@
setCampaignNameKey, setCampaignKeywordKey,
getConsentRequestsQueue, requireConsent, getRememberedConsent, hasRememberedConsent, isConsentRequired,
setConsentGiven, rememberConsentGiven, forgetConsentGiven, unload, hasConsent,
- discardHashTag, alwaysUseSendBeacon, disableAlwaysUseSendBeacon,
+ discardHashTag, alwaysUseSendBeacon, disableAlwaysUseSendBeacon, isUsingAlwaysUseSendBeacon,
setCookieNamePrefix, setCookieDomain, setCookiePath, setSecureCookie, setVisitorIdCookie, getCookieDomain, hasCookies, setSessionCookie,
setVisitorCookieTimeout, setSessionCookieTimeout, setReferralCookieTimeout, getCookie, getCookiePath, getSessionCookieTimeout,
setConversionAttributionFirstReferrer, tracker, request,
@@ -4827,6 +4827,9 @@ if (typeof window.Matomo !== 'object') {
this.getContent = function () {
return content;
};
+ this.isUsingAlwaysUseSendBeacon = function () {
+ return configAlwaysUseSendBeacon;
+ };
this.buildContentImpressionRequest = buildContentImpressionRequest;
this.buildContentInteractionRequest = buildContentInteractionRequest;
@@ -5504,12 +5507,21 @@ if (typeof window.Matomo !== 'object') {
};
/**
- * Set request method
+ * Set request method. If you specify GET then it will automatically disable sendBeacon.
*
* @param string method GET or POST; default is GET
*/
this.setRequestMethod = function (method) {
- configRequestMethod = method || defaultRequestMethod;
+ if (method) {
+ configRequestMethod = String(method).toUpperCase();
+ } else {
+ configRequestMethod = defaultRequestMethod;
+ }
+
+ if (configRequestMethod === 'GET') {
+ // send beacon always sends a POST request so we have to disable it to make GET work
+ this.disableAlwaysUseSendBeacon();
+ }
};
/**