If every user is patient, fully loads the page, doesn’t click away fast, nor swaps tabs, or loses connectivity. Then they would all be counted by analytics. However in the real world, over a population of users these are more common. And in these scenarios, analytics code may not load. Providing a smaller payload, ensures more of these scenarios are captured. This means more accurate data for more users.
The inverse is also true, if you only count the visitors which are most engaged, analytics will end up over reporting the true performance. Thus speed is vital for accuracy. Slower analytics can have as big a difference as 10-15% discrepancies.
What happens when you load analytics:
1. Your browser sends a request to download the script.
2. The server sends the script to your browser.
3. Your browser loads the script and executes it.
The larger the payload, the longer the initialization, time to transfer, and then time to execute code on your device. In mobile environments, this is particularly important.
Analytics systems use CDN’s (content distribution networks) so that visitors can download the code closer to them. And to use optimized networks, to deliver the code faster, with less latency. Latency is the delay between when the script is asked for and it is received.
Caching is also used, to avoid repeat loading of the script. Caching is where a prior loaded copy of the script can be used instead of requesting a new one.