Tracking completion of external forms
Posted: Wed Jan 29, 2025 4:02 am
If you use external forms on your site, then when they are filled out, the Autotrack plugin will send the corresponding events.
"True" session duration
In Google Analytics, session time is calculated as the duration between the first and last interaction (page view, event or transaction). That is, nothing can be found out about the duration of the last page view. The user can study it carefully and even perform some active actions, but we will not see how much time he spends on the page.
To track the moment a user leaves, the Autotrack plugin uses an interesting mechanic:
The window.unload event is tracked - it is triggered singapore consumer email list when the user navigates away from the current page. There can be many reasons: closing the current window, clicking on an external link, or simply reloading the page - all of these will cause the event to appear.
When this condition is triggered, an event will be sent to Google Analytics not via standard JavaScript, but via beacon - this is one of the methods for transmitting data to Google Analytics.
Most modern browsers support this mechanic. In events, it will be displayed as follows:
251-4.png
The duration of viewing will be transmitted as the value of the event. Then it can be used, for example, as a goal. But the time is taken from the timestamp format, so to translate it into an adequate form, the value must be divided by 1000 (calculated metrics inside Google Analytics can be useful here).
"True" session duration
In Google Analytics, session time is calculated as the duration between the first and last interaction (page view, event or transaction). That is, nothing can be found out about the duration of the last page view. The user can study it carefully and even perform some active actions, but we will not see how much time he spends on the page.
To track the moment a user leaves, the Autotrack plugin uses an interesting mechanic:
The window.unload event is tracked - it is triggered singapore consumer email list when the user navigates away from the current page. There can be many reasons: closing the current window, clicking on an external link, or simply reloading the page - all of these will cause the event to appear.
When this condition is triggered, an event will be sent to Google Analytics not via standard JavaScript, but via beacon - this is one of the methods for transmitting data to Google Analytics.
Most modern browsers support this mechanic. In events, it will be displayed as follows:
251-4.png
The duration of viewing will be transmitted as the value of the event. Then it can be used, for example, as a goal. But the time is taken from the timestamp format, so to translate it into an adequate form, the value must be divided by 1000 (calculated metrics inside Google Analytics can be useful here).