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:
authordiosmosis <benaka@piwik.pro>2015-05-07 08:46:08 +0300
committerdiosmosis <benaka@piwik.pro>2015-05-07 08:46:08 +0300
commitbe7b646dcd158b3ef328df374c1122ee97332558 (patch)
tree9e25fc493b5003d32c809977e4f9e0d6d556e52b /js
parent3b11a5d398d28dcf0e20036ad5f5e01c567e0f42 (diff)
parent3c05950a5f28e15b16b63fa4149c187163663f99 (diff)
Merge branch 'master' into config_step_2
Conflicts: core/CliMulti/RequestCommand.php
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js40
1 files changed, 32 insertions, 8 deletions
diff --git a/js/piwik.js b/js/piwik.js
index 50d589969e..8d1a735e32 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -433,7 +433,7 @@ if (typeof JSON2 !== 'object') {
setHeartBeatTimer, killFrame, redirectFile, setCountPreRendered,
trackGoal, trackLink, trackPageView, trackSiteSearch, trackEvent,
setEcommerceView, addEcommerceItem, trackEcommerceOrder, trackEcommerceCartUpdate,
- deleteCookies, offsetTop, offsetLeft, offsetHeight, offsetWidth, nodeType, defaultView,
+ deleteCookie, deleteCookies, offsetTop, offsetLeft, offsetHeight, offsetWidth, nodeType, defaultView,
innerHTML, scrollLeft, scrollTop, currentStyle, getComputedStyle, querySelectorAll, splice,
getAttribute, hasAttribute, attributes, nodeName, findContentNodes, findContentNodes, findContentNodesWithinNode,
findPieceNode, findTargetNodeNoDefault, findTargetNode, findContentPiece, children, hasNodeCssClass,
@@ -2668,6 +2668,8 @@ if (typeof Piwik !== 'object') {
if(visitorUUID.length) {
uuid = visitorUUID;
+ } else if ('0' === hasCookies()){
+ uuid = '';
} else {
uuid = generateRandomUuid();
}
@@ -2801,15 +2803,33 @@ if (typeof Piwik !== 'object') {
];
}
+ function deleteCookie(cookieName, path, domain) {
+ setCookie(cookieName, '', -86400, path, domain);
+ }
+
+ function isPossibleToSetCookieOnDomain(domainToTest)
+ {
+ var valueToSet = 'testvalue';
+ setCookie('test', valueToSet, 10000, null, domainToTest);
+
+ if (getCookie('test') === valueToSet) {
+ deleteCookie('test', null, domainToTest);
+
+ return true;
+ }
+
+ return false;
+ }
+
function deleteCookies() {
var savedConfigCookiesDisabled = configCookiesDisabled;
// 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);
+ deleteCookie(getCookieName('id'), configCookiePath, configCookieDomain);
+ deleteCookie(getCookieName('ses'), configCookiePath, configCookieDomain);
+ deleteCookie(getCookieName('cvar'), configCookiePath, configCookieDomain);
+ deleteCookie(getCookieName('ref'), configCookiePath, configCookieDomain);
configCookiesDisabled = savedConfigCookiesDisabled;
}
@@ -4145,7 +4165,7 @@ if (typeof Piwik !== 'object') {
/**
* Get visitor ID (from first party cookie)
*
- * @return string Visitor ID in hexits (or null, if not yet known)
+ * @return string Visitor ID in hexits (or empty string, if not yet known)
*/
getVisitorId: function () {
return getValuesFromVisitorIdCookie().uuid;
@@ -4643,8 +4663,12 @@ if (typeof Piwik !== 'object') {
* @param string domain
*/
setCookieDomain: function (domain) {
- configCookieDomain = domainFixup(domain);
- updateDomainHash();
+ var domainFixed = domainFixup(domain);
+
+ if (isPossibleToSetCookieOnDomain(domainFixed)) {
+ configCookieDomain = domainFixed;
+ updateDomainHash();
+ }
},
/**