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:
authorMatthieu Aubry <mattab@users.noreply.github.com>2018-04-23 07:28:58 +0300
committerGitHub <noreply@github.com>2018-04-23 07:28:58 +0300
commitfdb161b4d2a423a092dd4144b3cc1026bdd930ad (patch)
treecd693f5724e3f085a6a5d56923cfc32eac7baef5 /js
parent14ba6a44029e29a9336efdd482875df641bd2a82 (diff)
When setting or resetting User ID, do not update the Visitor ID in the first party cookie (#12742)
* When setting or resetting User ID, do not update the Visitor ID in the first party cookie * Forgot a file * Fix the JS tracker tests
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js240
-rw-r--r--js/piwik.min.js8
2 files changed, 125 insertions, 123 deletions
diff --git a/js/piwik.js b/js/piwik.js
index 6991b21dd3..4d1a4b557b 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -98,9 +98,9 @@ if (typeof JSON_PIWIK !== 'object' && typeof window.JSON === 'object' && window.
// The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
// results for certain dates in Opera >= 10.53.
isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&
- // Safari < 2.0.2 stores the internal millisecond time value correctly,
- // but clips the values returned by the date methods to the range of
- // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
+ // Safari < 2.0.2 stores the internal millisecond time value correctly,
+ // but clips the values returned by the date methods to the range of
+ // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;
} catch (exception) {}
@@ -135,54 +135,54 @@ if (typeof JSON_PIWIK !== 'object' && typeof window.JSON === 'object' && window.
// Firefox 3.1b1 and b2 serialize string, number, and boolean
// primitives as object literals.
stringify(0) === "0" &&
- // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
- // literals.
+ // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
+ // literals.
stringify(new Number()) === "0" &&
stringify(new String()) == '""' &&
- // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
- // does not define a canonical JSON representation (this applies to
- // objects with `toJSON` properties as well, *unless* they are nested
- // within an object or array).
+ // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
+ // does not define a canonical JSON representation (this applies to
+ // objects with `toJSON` properties as well, *unless* they are nested
+ // within an object or array).
stringify(getClass) === undef &&
- // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
- // FF 3.1b3 pass this test.
+ // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
+ // FF 3.1b3 pass this test.
stringify(undef) === undef &&
- // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
- // respectively, if the value is omitted entirely.
+ // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
+ // respectively, if the value is omitted entirely.
stringify() === undef &&
- // FF 3.1b1, 2 throw an error if the given value is not a number,
- // string, array, object, Boolean, or `null` literal. This applies to
- // objects with custom `toJSON` methods as well, unless they are nested
- // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
- // methods entirely.
+ // FF 3.1b1, 2 throw an error if the given value is not a number,
+ // string, array, object, Boolean, or `null` literal. This applies to
+ // objects with custom `toJSON` methods as well, unless they are nested
+ // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
+ // methods entirely.
stringify(value) === "1" &&
stringify([value]) == "[1]" &&
- // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
- // `"[null]"`.
+ // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
+ // `"[null]"`.
stringify([undef]) == "[null]" &&
- // YUI 3.0.0b1 fails to serialize `null` literals.
+ // YUI 3.0.0b1 fails to serialize `null` literals.
stringify(null) == "null" &&
- // FF 3.1b1, 2 halts serialization if an array contains a function:
- // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3
- // elides non-JSON values from objects and arrays, unless they
- // define custom `toJSON` methods.
+ // FF 3.1b1, 2 halts serialization if an array contains a function:
+ // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3
+ // elides non-JSON values from objects and arrays, unless they
+ // define custom `toJSON` methods.
stringify([undef, getClass, null]) == "[null,null,null]" &&
- // Simple serialization test. FF 3.1b1 uses Unicode escape sequences
- // where character escape codes are expected (e.g., `\b` => `\u0008`).
+ // Simple serialization test. FF 3.1b1 uses Unicode escape sequences
+ // where character escape codes are expected (e.g., `\b` => `\u0008`).
stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized &&
- // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
+ // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
stringify(null, value) === "1" &&
stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
- // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
- // serialize extended years.
+ // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
+ // serialize extended years.
stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
- // The milliseconds are optional in ES 5, but required in 5.1.
+ // The milliseconds are optional in ES 5, but required in 5.1.
stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
- // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
- // four-digit years instead of six-digit years. Credits: @Yaffle.
+ // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
+ // four-digit years instead of six-digit years. Credits: @Yaffle.
stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
- // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
- // values less than 1000. Credits: @Yaffle.
+ // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
+ // values less than 1000. Credits: @Yaffle.
stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
} catch (exception) {
stringifySupported = false;
@@ -470,10 +470,10 @@ if (typeof JSON_PIWIK !== 'object' && typeof window.JSON === 'object' && window.
// Serialize extended years correctly.
value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +
"-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) +
- // Months, dates, hours, minutes, and seconds should have two
- // digits; milliseconds should have three.
+ // Months, dates, hours, minutes, and seconds should have two
+ // digits; milliseconds should have three.
"T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) +
- // Milliseconds are optional in ES 5.0, but required in 5.1.
+ // Milliseconds are optional in ES 5.0, but required in 5.1.
"." + toPaddedString(3, milliseconds) + "Z";
} else {
value = null;
@@ -1012,7 +1012,7 @@ if (typeof JSON_PIWIK !== 'object' && typeof window.JSON === 'object' && window.
CONTENT_ATTR, CONTENT_CLASS, CONTENT_NAME_ATTR, CONTENT_PIECE_ATTR, CONTENT_PIECE_CLASS,
CONTENT_TARGET_ATTR, CONTENT_TARGET_CLASS, CONTENT_IGNOREINTERACTION_ATTR, CONTENT_IGNOREINTERACTION_CLASS,
trackCallbackOnLoad, trackCallbackOnReady, buildContentImpressionsRequests, wasContentImpressionAlreadyTracked,
- getQuery, getContent, getContentImpressionsRequestsFromNodes, buildContentInteractionTrackingRedirectUrl,
+ getQuery, getContent, setVisitorId, getContentImpressionsRequestsFromNodes, buildContentInteractionTrackingRedirectUrl,
buildContentInteractionRequestNode, buildContentInteractionRequest, buildContentImpressionRequest,
appendContentInteractionToRequestIfPossible, setupInteractionsTracking, trackContentImpressionClickInteraction,
internalIsNodeVisible, clearTrackedContentImpressions, getTrackerUrl, trackAllContentImpressions,
@@ -1668,18 +1668,18 @@ if (typeof window.Piwik !== 'object') {
}
switch (str_len & 3) {
- case 0:
- i = 0x080000000;
- break;
- case 1:
- i = str.charCodeAt(str_len - 1) << 24 | 0x0800000;
- break;
- case 2:
- i = str.charCodeAt(str_len - 2) << 24 | str.charCodeAt(str_len - 1) << 16 | 0x08000;
- break;
- case 3:
- i = str.charCodeAt(str_len - 3) << 24 | str.charCodeAt(str_len - 2) << 16 | str.charCodeAt(str_len - 1) << 8 | 0x80;
- break;
+ case 0:
+ i = 0x080000000;
+ break;
+ case 1:
+ i = str.charCodeAt(str_len - 1) << 24 | 0x0800000;
+ break;
+ case 2:
+ i = str.charCodeAt(str_len - 2) << 24 | str.charCodeAt(str_len - 1) << 16 | 0x08000;
+ break;
+ case 3:
+ i = str.charCodeAt(str_len - 3) << 24 | str.charCodeAt(str_len - 2) << 16 | str.charCodeAt(str_len - 1) << 8 | 0x80;
+ break;
}
word_array.push(i);
@@ -1778,8 +1778,8 @@ if (typeof window.Piwik !== 'object') {
href = getUrlParameter(href, 'u');
hostName = getHostName(href);
} else if (hostName === 'cc.bingj.com' || // Bing
- hostName === 'webcache.googleusercontent.com' || // Google
- hostName.slice(0, 5) === '74.6.') { // Yahoo (via Inktomi 74.6.0.0/16)
+ hostName === 'webcache.googleusercontent.com' || // Google
+ hostName.slice(0, 5) === '74.6.') { // Yahoo (via Inktomi 74.6.0.0/16)
href = documentAlias.links[0].href;
hostName = getHostName(href);
}
@@ -1991,11 +1991,11 @@ if (typeof window.Piwik !== 'object') {
}
if (!isDefined(t) ||
- !isDefined(r) ||
- !isDefined(b) ||
- !isDefined(l) ||
- !isDefined(w) ||
- !isDefined(h)) {
+ !isDefined(r) ||
+ !isDefined(b) ||
+ !isDefined(l) ||
+ !isDefined(w) ||
+ !isDefined(h)) {
t = el.offsetTop;
l = el.offsetLeft;
b = t + el.offsetHeight;
@@ -2016,11 +2016,11 @@ if (typeof window.Piwik !== 'object') {
if (
//-- If the target element is to the right of the parent elm
l + VISIBLE_PADDING > p.offsetWidth + p.scrollLeft ||
- //-- If the target element is to the left of the parent elm
+ //-- If the target element is to the left of the parent elm
l + w - VISIBLE_PADDING < p.scrollLeft ||
- //-- If the target element is under the parent elm
+ //-- If the target element is under the parent elm
t + VISIBLE_PADDING > p.offsetHeight + p.scrollTop ||
- //-- If the target element is above the parent elm
+ //-- If the target element is above the parent elm
t + h - VISIBLE_PADDING < p.scrollTop
) {
//-- Our target element is out of bounds:
@@ -2710,7 +2710,7 @@ if (typeof window.Piwik !== 'object') {
buildImpressionRequestParams: function (name, piece, target)
{
var params = 'c_n=' + encodeWrapper(name) +
- '&c_p=' + encodeWrapper(piece);
+ '&c_p=' + encodeWrapper(piece);
if (target) {
params += '&c_t=' + encodeWrapper(target);
@@ -2904,7 +2904,7 @@ if (typeof window.Piwik !== 'object') {
// check whether we were redirected from the piwik overlay plugin
var referrerRegExp = new RegExp('index\\.php\\?module=Overlay&action=startOverlaySession'
- + '&idSite=([0-9]+)&period=([^&]+)&date=([^&]+)(&segment=.*)?$');
+ + '&idSite=([0-9]+)&period=([^&]+)&date=([^&]+)(&segment=.*)?$');
var match = referrerRegExp.exec(documentAlias.referrer);
@@ -2995,12 +2995,12 @@ if (typeof window.Piwik !== 'object') {
************************************************************/
var
-/*<DEBUG>*/
+ /*<DEBUG>*/
/*
* registered test hooks
*/
registeredHooks = {},
-/*</DEBUG>*/
+ /*</DEBUG>*/
trackerInstance = this,
// Current URL and Referrer URL
@@ -4267,8 +4267,8 @@ if (typeof window.Piwik !== 'object') {
if (currentReferrerHostName.length && // there is a referrer
!isSiteHostName(currentReferrerHostName) && // domain is not the current domain
(!configConversionAttributionFirstReferrer || // attribute to last known referrer
- !originalReferrerHostName.length || // previously empty
- isSiteHostName(originalReferrerHostName))) { // previously set but in current domain
+ !originalReferrerHostName.length || // previously empty
+ isSiteHostName(originalReferrerHostName))) { // previously set but in current domain
referralUrl = configReferrerUrl;
}
@@ -4289,22 +4289,22 @@ if (typeof window.Piwik !== 'object') {
// build out the rest of the request
request += '&idsite=' + configTrackerSiteId +
- '&rec=1' +
- '&r=' + String(Math.random()).slice(2, 8) + // keep the string to a minimum
- '&h=' + now.getHours() + '&m=' + now.getMinutes() + '&s=' + now.getSeconds() +
- '&url=' + encodeWrapper(purify(currentUrl)) +
- (configReferrerUrl.length ? '&urlref=' + encodeWrapper(purify(configReferrerUrl)) : '') +
- ((configUserId && configUserId.length) ? '&uid=' + encodeWrapper(configUserId) : '') +
- '&_id=' + cookieVisitorIdValues.uuid + '&_idts=' + cookieVisitorIdValues.createTs + '&_idvc=' + cookieVisitorIdValues.visitCount +
- '&_idn=' + cookieVisitorIdValues.newVisitor + // currently unused
- (campaignNameDetected.length ? '&_rcn=' + encodeWrapper(campaignNameDetected) : '') +
- (campaignKeywordDetected.length ? '&_rck=' + encodeWrapper(campaignKeywordDetected) : '') +
- '&_refts=' + referralTs +
- '&_viewts=' + cookieVisitorIdValues.lastVisitTs +
- (String(cookieVisitorIdValues.lastEcommerceOrderTs).length ? '&_ects=' + cookieVisitorIdValues.lastEcommerceOrderTs : '') +
- (String(referralUrl).length ? '&_ref=' + encodeWrapper(purify(referralUrl.slice(0, referralUrlMaxLength))) : '') +
- (charSet ? '&cs=' + encodeWrapper(charSet) : '') +
- '&send_image=0';
+ '&rec=1' +
+ '&r=' + String(Math.random()).slice(2, 8) + // keep the string to a minimum
+ '&h=' + now.getHours() + '&m=' + now.getMinutes() + '&s=' + now.getSeconds() +
+ '&url=' + encodeWrapper(purify(currentUrl)) +
+ (configReferrerUrl.length ? '&urlref=' + encodeWrapper(purify(configReferrerUrl)) : '') +
+ ((configUserId && configUserId.length) ? '&uid=' + encodeWrapper(configUserId) : '') +
+ '&_id=' + cookieVisitorIdValues.uuid + '&_idts=' + cookieVisitorIdValues.createTs + '&_idvc=' + cookieVisitorIdValues.visitCount +
+ '&_idn=' + cookieVisitorIdValues.newVisitor + // currently unused
+ (campaignNameDetected.length ? '&_rcn=' + encodeWrapper(campaignNameDetected) : '') +
+ (campaignKeywordDetected.length ? '&_rck=' + encodeWrapper(campaignKeywordDetected) : '') +
+ '&_refts=' + referralTs +
+ '&_viewts=' + cookieVisitorIdValues.lastVisitTs +
+ (String(cookieVisitorIdValues.lastEcommerceOrderTs).length ? '&_ects=' + cookieVisitorIdValues.lastEcommerceOrderTs : '') +
+ (String(referralUrl).length ? '&_ref=' + encodeWrapper(purify(referralUrl.slice(0, referralUrlMaxLength))) : '') +
+ (charSet ? '&cs=' + encodeWrapper(charSet) : '') +
+ '&send_image=0';
// browser features
for (i in browserFeatures) {
@@ -4477,13 +4477,13 @@ if (typeof window.Piwik !== 'object') {
// Set price to zero
if (!isDefined(ecommerceItems[sku][3])
- || String(ecommerceItems[sku][3]).length === 0) {
+ || String(ecommerceItems[sku][3]).length === 0) {
ecommerceItems[sku][3] = 0;
}
// Set quantity to 1
if (!isDefined(ecommerceItems[sku][4])
- || String(ecommerceItems[sku][4]).length === 0) {
+ || String(ecommerceItems[sku][4]).length === 0) {
ecommerceItems[sku][4] = 1;
}
@@ -4502,7 +4502,7 @@ if (typeof window.Piwik !== 'object') {
function logEcommerceOrder(orderId, grandTotal, subTotal, tax, shipping, discount) {
if (String(orderId).length
- && isDefined(grandTotal)) {
+ && isDefined(grandTotal)) {
logEcommerce(orderId, grandTotal, subTotal, tax, shipping, discount);
}
}
@@ -4558,7 +4558,7 @@ if (typeof window.Piwik !== 'object') {
var downloadPattern = getClassesRegExp(configDownloadClasses, 'download'),
linkPattern = getClassesRegExp(configLinkClasses, 'link'),
- // does file extension indicate that it is a download?
+ // does file extension indicate that it is a download?
downloadExtensionsPattern = new RegExp('\\.(' + configDownloadExtensions.join('|') + ')([?&#]|$)', 'i');
if (linkPattern.test(className)) {
@@ -4582,7 +4582,7 @@ if (typeof window.Piwik !== 'object') {
parentElement = sourceElement.parentNode;
while (parentElement !== null &&
- /* buggy IE5.5 */
+ /* buggy IE5.5 */
isDefined(parentElement)) {
if (query.isLinkElement(sourceElement)) {
@@ -5016,9 +5016,9 @@ if (typeof window.Piwik !== 'object') {
function buildEventRequest(category, action, name, value)
{
return 'e_c=' + encodeWrapper(category)
- + '&e_a=' + encodeWrapper(action)
- + (isDefined(name) ? '&e_n=' + encodeWrapper(name) : '')
- + (isDefined(value) ? '&e_v=' + encodeWrapper(value) : '');
+ + '&e_a=' + encodeWrapper(action)
+ + (isDefined(name) ? '&e_n=' + encodeWrapper(name) : '')
+ + (isDefined(value) ? '&e_v=' + encodeWrapper(value) : '');
}
/*
@@ -5032,10 +5032,10 @@ if (typeof window.Piwik !== 'object') {
return false;
}
var request = getRequest(
- buildEventRequest(category, action, name, value),
- customData,
- 'event'
- );
+ buildEventRequest(category, action, name, value),
+ customData,
+ 'event'
+ );
sendRequest(request, configTrackerPause, callback);
}
@@ -5045,8 +5045,8 @@ if (typeof window.Piwik !== 'object') {
*/
function logSiteSearch(keyword, category, resultsCount, customData) {
var request = getRequest('search=' + encodeWrapper(keyword)
- + (category ? '&search_cat=' + encodeWrapper(category) : '')
- + (isDefined(resultsCount) ? '&search_count=' + resultsCount : ''), customData, 'sitesearch');
+ + (category ? '&search_cat=' + encodeWrapper(category) : '')
+ + (isDefined(resultsCount) ? '&search_count=' + resultsCount : ''), customData, 'sitesearch');
sendRequest(request, configTrackerPause);
}
@@ -5182,8 +5182,8 @@ if (typeof window.Piwik !== 'object') {
targetLink = String(targetLink);
var isOutlink = targetLink.indexOf('//') === 0
- || targetLink.indexOf('http://') === 0
- || targetLink.indexOf('https://') === 0;
+ || targetLink.indexOf('http://') === 0
+ || targetLink.indexOf('https://') === 0;
if (!isOutlink) {
return false;
@@ -5508,9 +5508,9 @@ if (typeof window.Piwik !== 'object') {
// IE6/IE7 navigator.javaEnabled can't be aliased, so test directly
// on Edge navigator.javaEnabled() always returns `true`, so ignore it
if (!((new RegExp('Edge[ /](\\d+[\\.\\d]+)')).test(navigatorAlias.userAgent)) &&
- typeof navigator.javaEnabled !== 'unknown' &&
- isDefined(navigatorAlias.javaEnabled) &&
- navigatorAlias.javaEnabled()) {
+ typeof navigator.javaEnabled !== 'unknown' &&
+ isDefined(navigatorAlias.javaEnabled) &&
+ navigatorAlias.javaEnabled()) {
browserFeatures.java = '1';
}
@@ -5528,7 +5528,7 @@ if (typeof window.Piwik !== 'object') {
browserFeatures.res = parseInt(width, 10) + 'x' + parseInt(height, 10);
}
-/*<DEBUG>*/
+ /*<DEBUG>*/
/*
* Register a test hook. Using eval() permits access to otherwise
* privileged members.
@@ -5550,7 +5550,7 @@ if (typeof window.Piwik !== 'object') {
return hookObj;
}
-/*</DEBUG>*/
+ /*</DEBUG>*/
/************************************************************
* Constructor
@@ -5563,19 +5563,19 @@ if (typeof window.Piwik !== 'object') {
updateDomainHash();
setVisitorIdCookie();
-/*<DEBUG>*/
+ /*<DEBUG>*/
/*
* initialize test plugin
*/
executePluginMethod('run', null, registerHook);
-/*</DEBUG>*/
+ /*</DEBUG>*/
/************************************************************
* Public data and methods
************************************************************/
-/*<DEBUG>*/
+ /*<DEBUG>*/
/*
* Test hook accessors
*/
@@ -5589,6 +5589,9 @@ if (typeof window.Piwik !== 'object') {
this.getContent = function () {
return content;
};
+ this.setVisitorId = function (visitorId) {
+ visitorUUID = visitorId;
+ };
this.buildContentImpressionRequest = buildContentImpressionRequest;
this.buildContentInteractionRequest = buildContentInteractionRequest;
@@ -5639,7 +5642,7 @@ if (typeof window.Piwik !== 'object') {
asyncTrackers = [firstTracker];
};
this.getRemainingVisitorCookieTimeout = getRemainingVisitorCookieTimeout;
-/*</DEBUG>*/
+ /*</DEBUG>*/
/**
* Get visitor ID (from first party cookie)
@@ -5785,7 +5788,6 @@ if (typeof window.Piwik !== 'object') {
*/
this.resetUserId = function() {
configUserId = '';
- visitorUUID = generateRandomUuid();
};
/**
@@ -5798,7 +5800,6 @@ if (typeof window.Piwik !== 'object') {
return;
}
configUserId = userId;
- visitorUUID = hash(configUserId).substr(0, 16);
};
/**
@@ -5999,7 +6000,7 @@ if (typeof window.Piwik !== 'object') {
}
if (!isDefined(cvar)
- || (cvar && cvar[0] === '')) {
+ || (cvar && cvar[0] === '')) {
return false;
}
@@ -6196,6 +6197,7 @@ if (typeof window.Piwik !== 'object') {
return crossDomainTrackingEnabled;
};
+
/**
* By default, the two visits across domains will be linked together
* when the link is click and the page is loaded within 180 seconds.
@@ -6667,7 +6669,7 @@ if (typeof window.Piwik !== 'object') {
*/
this.disableHeartBeatTimer = function () {
heartBeatDown();
-
+
if (configHeartBeatDelay || heartBeatSetUp) {
if (windowAlias.removeEventListener) {
windowAlias.removeEventListener('focus', heartBeatOnFocus, true);
@@ -7048,7 +7050,7 @@ if (typeof window.Piwik !== 'object') {
// On a category page, do not track Product name not defined
if ((!isDefined(sku) || !sku.length)
- && (!isDefined(name) || !name.length)) {
+ && (!isDefined(name) || !name.length)) {
return;
}
@@ -7495,12 +7497,12 @@ if (typeof window.Piwik !== 'object') {
window.Piwik.addTracker();
} else {
_paq = {push: function (args) {
- // needed to write it this way for jslint
- var consoleType = typeof console;
- if (consoleType !== 'undefined' && console && console.error) {
- console.error('_paq.push() was used but Piwik tracker was not initialized before the piwik.js file was loaded. Make sure to configure the tracker via _paq.push before loading piwik.js. Alternatively, you can create a tracker via Piwik.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.', args);
- }
- }};
+ // needed to write it this way for jslint
+ var consoleType = typeof console;
+ if (consoleType !== 'undefined' && console && console.error) {
+ console.error('_paq.push() was used but Piwik tracker was not initialized before the piwik.js file was loaded. Make sure to configure the tracker via _paq.push before loading piwik.js. Alternatively, you can create a tracker via Piwik.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.', args);
+ }
+ }};
}
}
diff --git a/js/piwik.min.js b/js/piwik.min.js
index e7624d6f7e..92b39626d4 100644
--- a/js/piwik.min.js
+++ b/js/piwik.min.js
@@ -58,10 +58,10 @@ return false}var c0=ch(cz(c1,c3,cZ,c2),c5,"event");bt(c0,bx,c4)}function bW(cZ,c
if(!c0||aM(c0)){return}c0=k(c0,ap);if(c0.indexOf("?")>0){c0+="&"}else{c0+="?"}var c1=bh();c0=E(c0,ap,c1);aa.setAnyAttribute(cZ,"href",c0)}function au(c2){var c3=aa.getAttributeValueFromNode(c2,"href");if(!c3){return false}c3=String(c3);var c0=c3.indexOf("//")===0||c3.indexOf("http://")===0||c3.indexOf("https://")===0;if(!c0){return false}var cZ=c2.pathname||b9(c2.href);var c1=(c2.hostname||d(c2.href)).toLowerCase();if(am(c1,cZ)){if(!ct(cE,K(c1))){return true}return false}return false}function cs(cZ){var c0=cT(cZ);if(c0&&c0.type){c0.href=p(c0.href);cK(c0.href,c0.type,undefined,null,cZ);return}if(cx){cZ=ao(cZ);if(au(cZ)){b7(cZ)}}}function ck(){return F.all&&!F.addEventListener}function cF(cZ){var c1=cZ.which;var c0=(typeof cZ.button);if(!c1&&c0!=="undefined"){if(ck()){if(cZ.button&1){c1=1}else{if(cZ.button&2){c1=3}else{if(cZ.button&4){c1=2}}}}else{if(cZ.button===0||cZ.button==="0"){c1=1}else{if(cZ.button&1){c1=2}else{if(cZ.button&2){c1=3}}}}}return c1}function bH(cZ){switch(cF(cZ)){case 1:return"left";
case 2:return"middle";case 3:return"right"}}function aT(cZ){return cZ.target||cZ.srcElement}function av(cZ){return function(c2){c2=c2||S.event;var c1=bH(c2);var c3=aT(c2);if(c2.type==="click"){var c0=false;if(cZ&&c1==="middle"){c0=true}if(c3&&!c0){cs(c3)}}else{if(c2.type==="mousedown"){if(c1==="middle"&&c3){aJ=c1;bq=c3}else{aJ=bq=null}}else{if(c2.type==="mouseup"){if(c1===aJ&&c3===bq){cs(c3)}aJ=bq=null}else{if(c2.type==="contextmenu"){cs(c3)}}}}}}function al(c1,c0){var cZ=typeof c0;if(cZ==="undefined"){c0=true}ai(c1,"click",av(c0),false);if(c0){ai(c1,"mouseup",av(c0),false);ai(c1,"mousedown",av(c0),false);ai(c1,"contextmenu",av(c0),false)}}function br(c1,c3){ak=true;var c2,c0=aS(bp,"ignore"),c4=F.links,cZ=null,c5=null;if(c4){for(c2=0;c2<c4.length;c2++){cZ=c4[c2];if(!c0.test(cZ.className)){c5=typeof cZ.piwikTrackers;if("undefined"===c5){cZ.piwikTrackers=[]}if(-1===L(cZ.piwikTrackers,c3)){cZ.piwikTrackers.push(c3);al(cZ,c1)}}}}}function aK(c0,c3,c4){if(b3){return true}b3=true;var c5=false;
var c2,c1;function cZ(){c5=true}n(function(){function c6(c8){setTimeout(function(){if(!b3){return}c5=false;c4.trackVisibleContentImpressions();c6(c8)},c8)}function c7(c8){setTimeout(function(){if(!b3){return}if(c5){c5=false;c4.trackVisibleContentImpressions()}c7(c8)},c8)}if(c0){c2=["scroll","resize"];for(c1=0;c1<c2.length;c1++){if(F.addEventListener){F.addEventListener(c2[c1],cZ)}else{S.attachEvent("on"+c2[c1],cZ)}}c7(100)}if(c3&&c3>0){c3=parseInt(c3,10);c6(c3)}})}function cr(){var c0,c2,c3={pdf:"application/pdf",qt:"video/quicktime",realp:"audio/x-pn-realaudio-plugin",wma:"application/x-mplayer2",dir:"application/x-director",fla:"application/x-shockwave-flash",java:"application/x-java-vm",gears:"application/x-googlegears",ag:"application/x-silverlight"};if(!((new RegExp("MSIE")).test(h.userAgent))){if(h.mimeTypes&&h.mimeTypes.length){for(c0 in c3){if(Object.prototype.hasOwnProperty.call(c3,c0)){c2=h.mimeTypes[c3[c0]];cP[c0]=(c2&&c2.enabledPlugin)?"1":"0"}}}if(!((new RegExp("Edge[ /](\\d+[\\.\\d]+)")).test(h.userAgent))&&typeof navigator.javaEnabled!=="unknown"&&I(h.javaEnabled)&&h.javaEnabled()){cP.java="1"
-}if(z(S.GearsFactory)){cP.gears="1"}cP.cookie=bT()}var c1=parseInt(V.width,10);var cZ=parseInt(V.height,10);cP.res=parseInt(c1,10)+"x"+parseInt(cZ,10)}cr();a8();aE();this.getVisitorId=function(){return aP().uuid};this.getVisitorInfo=function(){return cy()};this.getAttributionInfo=function(){return bA()};this.getAttributionCampaignName=function(){return bA()[0]};this.getAttributionCampaignKeyword=function(){return bA()[1]};this.getAttributionReferrerTimestamp=function(){return bA()[2]};this.getAttributionReferrerUrl=function(){return bA()[3]};this.setTrackerUrl=function(cZ){ax=cZ};this.getTrackerUrl=function(){return ax};this.getPiwikUrl=function(){return N(this.getTrackerUrl(),bv)};this.addTracker=function(cZ,c1){if(!c1){throw new Error("A siteId must be given to add a new tracker")}if(!I(cZ)||null===cZ){cZ=this.getTrackerUrl()}var c0=new P(cZ,c1);H.push(c0);return c0};this.getSiteId=function(){return bU};this.setSiteId=function(cZ){bR(cZ)};this.resetUserId=function(){bo="";bC=cB()};this.setUserId=function(cZ){if(!I(cZ)||!cZ.length){return
-}bo=cZ;bC=bV(bo).substr(0,16)};this.getUserId=function(){return bo};this.setCustomData=function(cZ,c0){if(U(cZ)){aj=cZ}else{if(!aj){aj={}}aj[cZ]=c0}};this.getCustomData=function(){return aj};this.setCustomRequestProcessing=function(cZ){bZ=cZ};this.appendToTrackingUrl=function(cZ){cI=cZ};this.getRequest=function(cZ){return ch(cZ)};this.addPlugin=function(cZ,c0){b[cZ]=c0};this.setCustomDimension=function(cZ,c0){cZ=parseInt(cZ,10);if(cZ>0){if(!I(c0)){c0=""}if(!w(c0)){c0=String(c0)}bc[cZ]=c0}};this.getCustomDimension=function(cZ){cZ=parseInt(cZ,10);if(cZ>0&&Object.prototype.hasOwnProperty.call(bc,cZ)){return bc[cZ]}};this.deleteCustomDimension=function(cZ){cZ=parseInt(cZ,10);if(cZ>0){delete bc[cZ]}};this.setCustomVariable=function(c0,cZ,c3,c1){var c2;if(!I(c1)){c1="visit"}if(!I(cZ)){return}if(!I(c3)){c3=""}if(c0>0){cZ=!w(cZ)?String(cZ):cZ;c3=!w(c3)?String(c3):c3;c2=[cZ.slice(0,bj),c3.slice(0,bj)];if(c1==="visit"||c1===2){cq();aI[c0]=c2}else{if(c1==="page"||c1===3){bK[c0]=c2}else{if(c1==="event"){ca[c0]=c2
-}}}}};this.getCustomVariable=function(c0,c1){var cZ;if(!I(c1)){c1="visit"}if(c1==="page"||c1===3){cZ=bK[c0]}else{if(c1==="event"){cZ=ca[c0]}else{if(c1==="visit"||c1===2){cq();cZ=aI[c0]}}}if(!I(cZ)||(cZ&&cZ[0]==="")){return false}return cZ};this.deleteCustomVariable=function(cZ,c0){if(this.getCustomVariable(cZ,c0)){this.setCustomVariable(cZ,"","",c0)}};this.deleteCustomVariables=function(cZ){if(cZ==="page"||cZ===3){bK={}}else{if(cZ==="event"){ca={}}else{if(cZ==="visit"||cZ===2){aI={}}}}};this.storeCustomVariablesInCookie=function(){bE=true};this.setLinkTrackingTimer=function(cZ){bx=cZ};this.getLinkTrackingTimer=function(){return bx};this.setDownloadExtensions=function(cZ){if(w(cZ)){cZ=cZ.split("|")}cO=cZ};this.addDownloadExtensions=function(c0){var cZ;if(w(c0)){c0=c0.split("|")}for(cZ=0;cZ<c0.length;cZ++){cO.push(c0[cZ])}};this.removeDownloadExtensions=function(c1){var c0,cZ=[];if(w(c1)){c1=c1.split("|")}for(c0=0;c0<cO.length;c0++){if(L(c1,cO[c0])===-1){cZ.push(cO[c0])}}cO=cZ};this.setDomains=function(cZ){aq=w(cZ)?[cZ]:cZ;
-var c3=false,c1=0,c0;for(c1;c1<aq.length;c1++){c0=String(aq[c1]);if(ct(cE,K(c0))){c3=true;break}var c2=b9(c0);if(c2&&c2!=="/"&&c2!=="/*"){c3=true;break}}if(!c3){aq.push(cE)}};this.enableCrossDomainLinking=function(){cx=true};this.disableCrossDomainLinking=function(){cx=false};this.isCrossDomainLinkingEnabled=function(){return cx};this.setCrossDomainLinkingTimeout=function(cZ){aR=cZ};this.getCrossDomainLinkingUrlParameter=function(){return t(ap)+"="+t(bh())};this.setIgnoreClasses=function(cZ){bp=w(cZ)?[cZ]:cZ};this.setRequestMethod=function(cZ){cR=cZ||b6};this.setRequestContentType=function(cZ){cl=cZ||aB};this.setReferrerUrl=function(cZ){bd=cZ};this.setCustomUrl=function(cZ){aW=bJ(bB,cZ)};this.getCurrentUrl=function(){return aW||bB};this.setDocumentTitle=function(cZ){a9=cZ};this.setAPIUrl=function(cZ){bv=cZ};this.setDownloadClasses=function(cZ){bz=w(cZ)?[cZ]:cZ};this.setLinkClasses=function(cZ){a0=w(cZ)?[cZ]:cZ};this.setCampaignNameKey=function(cZ){cf=w(cZ)?[cZ]:cZ};this.setCampaignKeywordKey=function(cZ){bu=w(cZ)?[cZ]:cZ
+}if(z(S.GearsFactory)){cP.gears="1"}cP.cookie=bT()}var c1=parseInt(V.width,10);var cZ=parseInt(V.height,10);cP.res=parseInt(c1,10)+"x"+parseInt(cZ,10)}cr();a8();aE();this.getVisitorId=function(){return aP().uuid};this.getVisitorInfo=function(){return cy()};this.getAttributionInfo=function(){return bA()};this.getAttributionCampaignName=function(){return bA()[0]};this.getAttributionCampaignKeyword=function(){return bA()[1]};this.getAttributionReferrerTimestamp=function(){return bA()[2]};this.getAttributionReferrerUrl=function(){return bA()[3]};this.setTrackerUrl=function(cZ){ax=cZ};this.getTrackerUrl=function(){return ax};this.getPiwikUrl=function(){return N(this.getTrackerUrl(),bv)};this.addTracker=function(cZ,c1){if(!c1){throw new Error("A siteId must be given to add a new tracker")}if(!I(cZ)||null===cZ){cZ=this.getTrackerUrl()}var c0=new P(cZ,c1);H.push(c0);return c0};this.getSiteId=function(){return bU};this.setSiteId=function(cZ){bR(cZ)};this.resetUserId=function(){bo=""};this.setUserId=function(cZ){if(!I(cZ)||!cZ.length){return
+}bo=cZ};this.getUserId=function(){return bo};this.setCustomData=function(cZ,c0){if(U(cZ)){aj=cZ}else{if(!aj){aj={}}aj[cZ]=c0}};this.getCustomData=function(){return aj};this.setCustomRequestProcessing=function(cZ){bZ=cZ};this.appendToTrackingUrl=function(cZ){cI=cZ};this.getRequest=function(cZ){return ch(cZ)};this.addPlugin=function(cZ,c0){b[cZ]=c0};this.setCustomDimension=function(cZ,c0){cZ=parseInt(cZ,10);if(cZ>0){if(!I(c0)){c0=""}if(!w(c0)){c0=String(c0)}bc[cZ]=c0}};this.getCustomDimension=function(cZ){cZ=parseInt(cZ,10);if(cZ>0&&Object.prototype.hasOwnProperty.call(bc,cZ)){return bc[cZ]}};this.deleteCustomDimension=function(cZ){cZ=parseInt(cZ,10);if(cZ>0){delete bc[cZ]}};this.setCustomVariable=function(c0,cZ,c3,c1){var c2;if(!I(c1)){c1="visit"}if(!I(cZ)){return}if(!I(c3)){c3=""}if(c0>0){cZ=!w(cZ)?String(cZ):cZ;c3=!w(c3)?String(c3):c3;c2=[cZ.slice(0,bj),c3.slice(0,bj)];if(c1==="visit"||c1===2){cq();aI[c0]=c2}else{if(c1==="page"||c1===3){bK[c0]=c2}else{if(c1==="event"){ca[c0]=c2}}}}};this.getCustomVariable=function(c0,c1){var cZ;
+if(!I(c1)){c1="visit"}if(c1==="page"||c1===3){cZ=bK[c0]}else{if(c1==="event"){cZ=ca[c0]}else{if(c1==="visit"||c1===2){cq();cZ=aI[c0]}}}if(!I(cZ)||(cZ&&cZ[0]==="")){return false}return cZ};this.deleteCustomVariable=function(cZ,c0){if(this.getCustomVariable(cZ,c0)){this.setCustomVariable(cZ,"","",c0)}};this.deleteCustomVariables=function(cZ){if(cZ==="page"||cZ===3){bK={}}else{if(cZ==="event"){ca={}}else{if(cZ==="visit"||cZ===2){aI={}}}}};this.storeCustomVariablesInCookie=function(){bE=true};this.setLinkTrackingTimer=function(cZ){bx=cZ};this.getLinkTrackingTimer=function(){return bx};this.setDownloadExtensions=function(cZ){if(w(cZ)){cZ=cZ.split("|")}cO=cZ};this.addDownloadExtensions=function(c0){var cZ;if(w(c0)){c0=c0.split("|")}for(cZ=0;cZ<c0.length;cZ++){cO.push(c0[cZ])}};this.removeDownloadExtensions=function(c1){var c0,cZ=[];if(w(c1)){c1=c1.split("|")}for(c0=0;c0<cO.length;c0++){if(L(c1,cO[c0])===-1){cZ.push(cO[c0])}}cO=cZ};this.setDomains=function(cZ){aq=w(cZ)?[cZ]:cZ;var c3=false,c1=0,c0;
+for(c1;c1<aq.length;c1++){c0=String(aq[c1]);if(ct(cE,K(c0))){c3=true;break}var c2=b9(c0);if(c2&&c2!=="/"&&c2!=="/*"){c3=true;break}}if(!c3){aq.push(cE)}};this.enableCrossDomainLinking=function(){cx=true};this.disableCrossDomainLinking=function(){cx=false};this.isCrossDomainLinkingEnabled=function(){return cx};this.setCrossDomainLinkingTimeout=function(cZ){aR=cZ};this.getCrossDomainLinkingUrlParameter=function(){return t(ap)+"="+t(bh())};this.setIgnoreClasses=function(cZ){bp=w(cZ)?[cZ]:cZ};this.setRequestMethod=function(cZ){cR=cZ||b6};this.setRequestContentType=function(cZ){cl=cZ||aB};this.setReferrerUrl=function(cZ){bd=cZ};this.setCustomUrl=function(cZ){aW=bJ(bB,cZ)};this.getCurrentUrl=function(){return aW||bB};this.setDocumentTitle=function(cZ){a9=cZ};this.setAPIUrl=function(cZ){bv=cZ};this.setDownloadClasses=function(cZ){bz=w(cZ)?[cZ]:cZ};this.setLinkClasses=function(cZ){a0=w(cZ)?[cZ]:cZ};this.setCampaignNameKey=function(cZ){cf=w(cZ)?[cZ]:cZ};this.setCampaignKeywordKey=function(cZ){bu=w(cZ)?[cZ]:cZ
};this.discardHashTag=function(cZ){bD=cZ};this.setCookieNamePrefix=function(cZ){ba=cZ;aI=bL()};this.setCookieDomain=function(cZ){var c0=K(cZ);if(bm(c0)){cG=c0;a8()}};this.getCookieDomain=function(){return cG};this.hasCookies=function(){return"1"===bT()};this.setSessionCookie=function(c1,c0,cZ){if(!c1){throw new Error("Missing cookie name")}if(!I(cZ)){cZ=cd}bk.push(c1);cU(aL(c1),c0,cZ,bf,cG)};this.getCookie=function(c0){var cZ=aw(aL(c0));if(cZ===0){return null}return cZ};this.setCookiePath=function(cZ){bf=cZ;a8()};this.getCookiePath=function(cZ){return bf};this.setVisitorCookieTimeout=function(cZ){cv=cZ*1000};this.setSessionCookieTimeout=function(cZ){cd=cZ*1000};this.getSessionCookieTimeout=function(){return cd};this.setReferralCookieTimeout=function(cZ){cN=cZ*1000};this.setConversionAttributionFirstReferrer=function(cZ){bl=cZ};this.setSecureCookie=function(cZ){bG=cZ};this.disableCookies=function(){bb=true;cP.cookie="0";if(bU){ay()}};this.deleteCookies=function(){ay()};this.setDoNotTrack=function(c0){var cZ=h.doNotTrack||h.msDoNotTrack;
cA=c0&&(cZ==="yes"||cZ==="1");if(cA){this.disableCookies()}};this.addListener=function(c0,cZ){al(c0,cZ)};this.enableLinkTracking=function(c0){cQ=true;var cZ=this;b5(function(){q(function(){br(c0,cZ)})})};this.enableJSErrorTracking=function(){if(cC){return}cC=true;var cZ=S.onerror;S.onerror=function(c4,c2,c1,c3,c0){b5(function(){var c5="JavaScript Errors";var c6=c2+":"+c1;if(c3){c6+=":"+c3}an(c5,c6,c4)});if(cZ){return cZ(c4,c2,c1,c3,c0)}return false}};this.disablePerformanceTracking=function(){aU=false};this.setGenerationTimeMs=function(cZ){cb=parseInt(cZ,10)};this.enableHeartBeatTimer=function(cZ){cZ=Math.max(cZ,1);aX=(cZ||15)*1000;if(cH!==null){cW()}};this.disableHeartBeatTimer=function(){by();if(aX||aG){if(S.removeEventListener){S.removeEventListener("focus",a2,true);S.removeEventListener("blur",ar,true)}else{if(S.detachEvent){S.detachEvent("onfocus",a2);S.detachEvent("onblur",ar)}}}aX=null;aG=false};this.killFrame=function(){if(S.location!==S.top.location){S.top.location=S.location}};
this.redirectFile=function(cZ){if(S.location.protocol==="file:"){S.location=cZ}};this.setCountPreRendered=function(cZ){a5=cZ};this.trackGoal=function(cZ,c1,c0){b5(function(){cD(cZ,c1,c0)})};this.trackLink=function(c0,cZ,c2,c1){b5(function(){cK(c0,cZ,c2,c1)})};this.getNumTrackedPageViews=function(){return cg};this.trackPageView=function(cZ,c1,c0){bY=[];if(M(bU)){b5(function(){W(ax,bv,bU)})}else{b5(function(){cg++;bO(cZ,c1,c0)})}};this.trackAllContentImpressions=function(){if(M(bU)){return}b5(function(){q(function(){var cZ=v.findContentNodes();var c0=cn(cZ);cV(c0,bx)})})};this.trackVisibleContentImpressions=function(cZ,c0){if(M(bU)){return}if(!I(cZ)){cZ=true}if(!I(c0)){c0=750}aK(cZ,c0,this);b5(function(){n(function(){var c1=v.findContentNodes();var c2=a1(c1);cV(c2,bx)})})};this.trackContentImpression=function(c1,cZ,c0){if(M(bU)){return}c1=a(c1);cZ=a(cZ);c0=a(c0);if(!c1){return}cZ=cZ||"Unknown";b5(function(){var c2=az(c1,cZ,c0);bt(c2,bx)})};this.trackContentImpressionsWithinNode=function(cZ){if(M(bU)||!cZ){return