Open googleanalyticsresoneo opened 10 years ago
Agree that this could be more gracefully handled but don't want to change as it would:
For now maybe we should just update the docs to make the standard _gasMultiDomain
value mousedown
instead of click
? Happy to accept the PR.
At least there should be more comments in the code or in the documentation on the benefits / risks of each methods
But it's very difficult to be sure that no link on a site is using an onclick
handler, then having a safe solution would be way better. Source code being readable is a matter of comments and structure...shouldn't be an obstacle to stability and safety.
By default we have _gas.push(['_gasMultiDomain', 'click']);
But when one of the links already has a function binded to the 'onclick' gas should try to use 'mousedown' as an alternative handler so that, for example, the link isn't opened twice
I had the case with 'onclick' doing a window.open in JS in a new window and gas opening in the current window, resulting in 2 page views, one in a new visit and the other one in the current visit....
It shouldn't be needed to change the behavior for all the links in the page, but be careful to change the default behavior when it's at risk because an existing onclick code.
What do you think ?