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
path: root/js
diff options
context:
space:
mode:
authorStevo Slavic <sslavic@gmail.com>2014-06-24 18:41:09 +0400
committerStevo Slavic <sslavic@gmail.com>2014-06-24 18:41:09 +0400
commitae6a2fb5ec8b562bd505d227a0661944eeec9ddb (patch)
treeb00bf4fd000bd053e270bd6851fd72d75a5a0802 /js
parent5dcff8f5cfdb6a1a5529a554f50dbf14a066bca8 (diff)
Added support for configuring tracking POST request content type
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/js/piwik.js b/js/piwik.js
index 296f7f63bf..cad614a2b6 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -415,7 +415,7 @@ if (typeof JSON2 !== 'object') {
setCustomRequestContentProcessing,
setCustomVariable, getCustomVariable, deleteCustomVariable,
setDownloadExtensions, addDownloadExtensions,
- setDomains, setIgnoreClasses, setRequestMethod,
+ setDomains, setIgnoreClasses, setRequestMethod, setRequestContentType,
setReferrerUrl, setCustomUrl, setAPIUrl, setDocumentTitle,
setDownloadClasses, setLinkClasses,
setCampaignNameKey, setCampaignKeywordKey,
@@ -1081,13 +1081,16 @@ if (typeof Piwik !== 'object') {
// Request method (GET or POST)
configRequestMethod = 'GET',
+ // Request Content-Type header value; applicable when POST request method is used for submitting tracking events
+ configRequestContentType = 'application/x-www-form-urlencoded; charset=UTF-8',
+
// Tracker URL
configTrackerUrl = trackerUrl || '',
// API URL (only set if it differs from the Tracker URL)
configApiUrl = '',
- // This string is appended to the Tracker URL Request (eg. to send data that is not handled by the existin setters/getters)
+ // This string is appended to the Tracker URL Request (eg. to send data that is not handled by the existing setters/getters)
configAppendToTrackingUrl = '',
// Site ID
@@ -1370,9 +1373,7 @@ if (typeof Piwik !== 'object') {
}
};
- // see XMLHttpRequest Level 2 spec, section 4.7.2 for invalid headers
- // @link http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
+ xhr.setRequestHeader('Content-Type', configRequestContentType);
xhr.send(request);
} catch (e) {
@@ -2621,6 +2622,17 @@ if (typeof Piwik !== 'object') {
},
/**
+ * Set request Content-Type header value, applicable when POST request method is used for submitting tracking events.
+ * See XMLHttpRequest Level 2 spec, section 4.7.2 for invalid headers
+ * @link http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html
+ *
+ * @param string requestContentType; default is 'application/x-www-form-urlencoded; charset=UTF-8'
+ */
+ setRequestContentType: function (requestContentType) {
+ configRequestContentType = requestContentType || 'application/x-www-form-urlencoded; charset=UTF-8';
+ },
+
+ /**
* Override referrer
*
* @param string url