Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix outlinks and downloads are not tracked if document is already ready when piwik.js is loaded #9925

Merged
merged 1 commit into from Mar 31, 2016

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Mar 15, 2016

This should fix #9924

I tested it in Chrome and Firefox so far. If website was already loaded we will now execute the enableLinkTracking logic directly.

@tsteur tsteur added Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Mar 15, 2016
@tsteur tsteur added this to the 2.16.1 milestone Mar 15, 2016
@@ -4689,7 +4619,7 @@ if (typeof window.Piwik !== 'object') {
} else if (windowAlias.addEventListener) {
windowAlias.addEventListener('load', callback);
} else if (windowAlias.attachEvent) {
windowAlias.attachEvent('onLoad', callback);
windowAlias.attachEvent('onload', callback);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be all lowercase actually. Possibly onLoad works as well but lowercase is better

@@ -1068,10 +1068,6 @@ if (typeof window.Piwik !== 'object') {
/* performance timing */
performanceAlias = windowAlias.performance || windowAlias.mozPerformance || windowAlias.msPerformance || windowAlias.webkitPerformance,

/* DOM Ready */
hasLoaded = false,
registeredOnLoadHandlers = [],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

registeredOnLoadHandlers + hasLoaded was only used for enableLinkTracking.

enableLinkTracking now uses existing trackCallbackOnReady instead

}

// sniff for older WebKit versions
if ((new RegExp('WebKit')).test(navigatorAlias.userAgent)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally removed this one as I think it's not needed anymore and it can actually slow down all websites in WebKit for a while for quite a bit. It executed this every 10ms until websites was ready. As it sometimes takes a few seconds until a website is ready it executes this quite often.

@tsteur tsteur changed the title fixes #9924 outlinks and downloads are not tracked if document is already ready when piwik.js is loaded Fix outlinks and downloads are not tracked if document is already ready when piwik.js is loaded Mar 15, 2016
@tsteur tsteur added Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. and removed not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. labels Mar 15, 2016
@mattab
Copy link
Member

mattab commented Mar 30, 2016

@tsteur do you mind testing that it still works fine on IE10 / IE11 or so?

Once confirmed +1 to merge this PR 👍 (note: there is currently a conflict, maybe you can remove the merged piwik.js from the commit)

@tsteur
Copy link
Member Author

tsteur commented Mar 31, 2016

Tested on IE10 and works. Will merge and do afterwards some more tests

@tsteur tsteur merged commit 870bc2c into master Mar 31, 2016
@tsteur tsteur deleted the 9924 branch March 31, 2016 20:20
@tsteur
Copy link
Member Author

tsteur commented Mar 31, 2016

I tested with IE8 and the callback works. I had some other problems tracking outlinks on IE8 but that was due to debugging mode likely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants