Here’s a more detailed explanation of how Google Analytics tracking code works:
Google Analytics cannot collect statistics on systems not connected to the Internet since it needs an online connection to perform its functions. Instead, it collects information through the HTTP request of the user, browser/system information, and first-party cookies. Therefore, solutions like e-commerce platforms, mobile applications, and online point-of-sales systems enable Analytics tracking code to record and report the activity. When the data is collected, it is transferred to Analytics servers that process the information to display the results in your reports.
Using tracking code, Google Analytics can report on data from which systems? https://developers.google.com/analytics/resources/concepts/gaConceptsTrackingOverview