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>2013-05-24 05:29:16 +0400
committermattab <matthieu.aubry@gmail.com>2013-05-24 05:29:16 +0400
commit2bd91ecbb4b0084192390d94a19b241449c3cc3a (patch)
tree5f7045db4ca9b34e1f0381b76bb4f264a1f624c8 /js
parent15277fb87b60a13d27173ba21348b85ce2d72193 (diff)
Fixes #3951
cheers Peter for finding this bad bug! The new deleteCookies function can be used, whenever new_visit=1 is used, to ensure the cookies are re-created for the new visitor. For example use as: _paq.push(["deleteCookies"]); _paq.push(["appendToTrackingUrl", "new_visit=1"]); put both at the same time. Make sure you remove the "deleteCookies" otherwise. This should fix it! I have updated the faq at http://piwik.org/faq/how-to/#faq_187
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js31
1 files changed, 22 insertions, 9 deletions
diff --git a/js/piwik.js b/js/piwik.js
index 3d5ab06472..6451c38e66 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -1547,7 +1547,17 @@ if (typeof Piwik !== 'object') {
];
}
- /*
+ function deleteCookies() {
+ // Temporarily allow cookies just to delete the existing ones
+ configCookiesDisabled = false;
+ setCookie(getCookieName('id'), '', -86400, configCookiePath, configCookieDomain);
+ setCookie(getCookieName('ses'), '', -86400, configCookiePath, configCookieDomain);
+ setCookie(getCookieName('cvar'), '', -86400, configCookiePath, configCookieDomain);
+ setCookie(getCookieName('ref'), '', -86400, configCookiePath, configCookieDomain);
+ configCookiesDisabled = true;
+ }
+
+ /**
* Returns the URL to call piwik.php,
* with the standard parameters (plugins, resolution, url, referrer, etc.).
* Sends the pageview and browser settings with every request in case of race conditions.
@@ -1569,7 +1579,6 @@ if (typeof Piwik !== 'object') {
currentReferrerHostName,
originalReferrerHostName,
customVariablesCopy = customVariables,
- idname = getCookieName('id'),
sesname = getCookieName('ses'),
refname = getCookieName('ref'),
cvarname = getCookieName('cvar'),
@@ -1581,13 +1590,7 @@ if (typeof Piwik !== 'object') {
campaignKeywordDetected;
if (configCookiesDisabled) {
- // Temporarily allow cookies just to delete the existing ones
- configCookiesDisabled = false;
- setCookie(idname, '', -86400, configCookiePath, configCookieDomain);
- setCookie(sesname, '', -86400, configCookiePath, configCookieDomain);
- setCookie(cvarname, '', -86400, configCookiePath, configCookieDomain);
- setCookie(refname, '', -86400, configCookiePath, configCookieDomain);
- configCookiesDisabled = true;
+ deleteCookies();
}
if (configDoNotTrack) {
@@ -2376,6 +2379,7 @@ if (typeof Piwik !== 'object') {
return configCustomData;
},
+
/**
* Set custom variable within this visit
*
@@ -2666,6 +2670,15 @@ if (typeof Piwik !== 'object') {
},
/**
+ * One off cookies clearing. Useful to call this when you know for sure a new visitor is using the same browser,
+ * it maybe help to "reset" tracking cookies to prevent data reuse for different users.
+ *
+ */
+ deleteCookies: function() {
+ deleteCookies();
+ },
+
+ /**
* Handle do-not-track requests
*
* @param bool enable If true, don't track if user agent sends 'do-not-track' header