Search
Clear search
Close search
Google apps
Main menu

Website data collection

Reading list

Notes

To track data from a website, Analytics provides a standard snippet of JavaScript tracking code. This snippet references a JavaScript library called analytics.js that controls what data is collected.

You simply add the standard code snippet before the closing tag in the HTML of every web page you want to track. This snippet generates a pageview hit each time a page is loaded. It’s essential that you place the Analytics tracking code on every page of your site. If you don’t, you won’t get a complete picture of all the interactions that happen within a given website session.

The Analytics tracking code executes JavaScript asynchronously, meaning that the JavaScript runs in the background while the browser performs other tasks. This means that the Analytics tracking code will continue to collect data while the browser renders the rest of the web page.

As the tracking code executes, Analytics creates unique identifiers to distinguish between users. There are different ways an identifier can be created. By default, the Analytics JavaScript uses a first-party cookie, but you can also create and use your own identifier.

When a page loads, the JavaScript collects information from the website itself, like the URL of the current page, and GCLIDs to be read by other Google products. The JavaScript also collects information from the browser, such as the user’s language preference, the browser name, and the device and operating system being used to access the site. All of this information is packaged up and sent to Google’s servers as a pageview hit. This process repeats each time a page is loaded in the browser.

Was this article helpful?
How can we improve it?
Google Analytics training and support resources

Check out our comprehensive list to learn more about Analytics solutions.