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:
authormattab <matthieu.aubry@gmail.com>2014-08-13 16:04:25 +0400
committermattab <matthieu.aubry@gmail.com>2014-08-13 16:04:25 +0400
commit0fe47ee992b0af32438eb92682e221e6bc70840a (patch)
tree996e20d16880adc935cd6b9c7348c989096cdec8 /js
parent01a76d252e2ced05c85be4cfc672e8df417c7104 (diff)
fixes #5415 Introducing `storeCustomVariablesInCookie` function.
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/js/piwik.js b/js/piwik.js
index 5de684129a..2dbb418aa7 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -413,7 +413,7 @@ if (typeof JSON2 !== 'object') {
getAttributionReferrerTimestamp, getAttributionReferrerUrl,
setCustomData, getCustomData,
setCustomRequestProcessing,
- setCustomVariable, getCustomVariable, deleteCustomVariable,
+ setCustomVariable, getCustomVariable, deleteCustomVariable, storeCustomVariablesInCookie,
setDownloadExtensions, addDownloadExtensions,
setDomains, setIgnoreClasses, setRequestMethod, setRequestContentType,
setReferrerUrl, setCustomUrl, setAPIUrl, setDocumentTitle,
@@ -1180,6 +1180,9 @@ if (typeof Piwik !== 'object') {
// Generation time set from the server
configPerformanceGenerationTime = 0,
+ // Whether Custom Variables scope "visit" should be stored in a cookie during the time of the visit
+ configStoreCustomVariablesInCookie = false,
+
// Custom Variables read from cookie, scope "visit"
customVariables = false,
@@ -1806,7 +1809,9 @@ if (typeof Piwik !== 'object') {
}
}
- setCookie(cvarname, JSON2.stringify(customVariables), configSessionCookieTimeout, configCookiePath, configCookieDomain);
+ if (configStoreCustomVariablesInCookie) {
+ setCookie(cvarname, JSON2.stringify(customVariables), configSessionCookieTimeout, configCookiePath, configCookieDomain);
+ }
}
// performance tracking
@@ -2580,6 +2585,16 @@ if (typeof Piwik !== 'object') {
},
/**
+ * When called then the Custom Variables of scope "visit" will be stored (persisted) in a first party cookie
+ * for the duration of the visit. This is useful if you want to call getCustomVariable later in the visit.
+ *
+ * By default, Custom Variables of scope "visit" are not stored on the visitor's computer.
+ */
+ storeCustomVariablesInCookie: function () {
+ configStoreCustomVariablesInCookie = true;
+ },
+
+ /**
* Set delay for link tracking (in milliseconds)
*
* @param int delay