When you add either of these tracking snippets to your website, you send a pageview for each page your users visit. Google Analytics processes this data and can infer a great deal of information including:
The total time a user spends on your site. The time a user spends on each page and in what order those pages were visited. What internal links were clicked (based on the URL of the next pageview). In addition, the IP address, user agent string, and initial page inspection analytics.js does when creating a new tracker is used to determine things like the following:
The geographic location of the user. What browser and operating system are being used. Screen size and whether Flash or Java is installed. The referring site.