diff options
author | sgiehl <stefan@piwik.org> | 2015-04-18 18:56:25 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2015-04-18 18:56:25 +0300 |
commit | 34225cfe35f14a9fa7747cfbba3059d7b2cfa73d (patch) | |
tree | 0fde99bf7d31639e8161ab583e7a1db3bf8913f7 /js/piwik.js | |
parent | 898afb809d54553dea34e4d101e66b37f50f0334 (diff) |
fixes #7663 - consider links with download attribute as downloads
Diffstat (limited to 'js/piwik.js')
-rw-r--r-- | js/piwik.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/js/piwik.js b/js/piwik.js index d4fef8025d..ba902e8e06 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -3224,7 +3224,7 @@ if (typeof Piwik !== 'object') { /* * Link or Download? */ - function getLinkType(className, href, isInLink) { + function getLinkType(className, href, isInLink, hasDownloadAttribute) { if (startsUrlWithTrackerUrl(href)) { return 0; } @@ -3236,11 +3236,11 @@ if (typeof Piwik !== 'object') { // does file extension indicate that it is a download? downloadExtensionsPattern = new RegExp('\\.(' + configDownloadExtensions.join('|') + ')([?&#]|$)', 'i'); - if (linkPattern.test(className)) { + if (!hasDownloadAttribute && linkPattern.test(className)) { return 'link'; } - if (downloadPattern.test(className) || downloadExtensionsPattern.test(href)) { + if (hasDownloadAttribute || downloadPattern.test(className) || downloadExtensionsPattern.test(href)) { return 'download'; } @@ -3298,7 +3298,7 @@ if (typeof Piwik !== 'object') { if (!scriptProtocol.test(sourceHref)) { // track outlinks and all downloads - var linkType = getLinkType(sourceElement.className, sourceHref, isSiteHostName(sourceHostName)); + var linkType = getLinkType(sourceElement.className, sourceHref, isSiteHostName(sourceHostName), query.hasNodeAttribute(sourceElement, 'download')); if (linkType) { return { |