Add onunload event tracking
jehna opened this issue · comments
Jesse Luoto commented
The v1
implemented the onunload event by default to correct the time spent on page (especially on bounces).
The original code:
var pageLoadedTimestamp = new Date().getTime();
/**
* Note:
* unload event does not fire on:
* - Android chrome on tab closing
*/
window.addEventListener(
'unload',
eventBuilder(
'timing',
{
'utc': 'JS Dependencies',
'utv': 'unload',
'utt': (new Date().getTime() - pageLoadedTimestamp)
}
)
);
Jesse Luoto commented
Probably will just mention this in the README.md
's migration section. While this was a great feature in v1, it probably should not be part of version 2.