Google Analytics

About Google Analytics

Google Analytics is the recommended tool to track user interaction and collect basic data from your website.

A Princeton Site Builder site can be tracked by Google Analytics. If you want to learn more about Google Analytics, visit the University's LinkedIn Learning training website (login required) and search for "Google Analytics Essential Training." You can also follow Google's instructions, titled "Get Started with Google Analytics."

Important note about Google Analytics 4

Google introduced a new version of its analytics product referred to as "Google Analytics 4." The previous version is referred to as "Universal Analytics." Both versions of Google Analytics are supported for now. All users of Universal Analytics will be required to upgrade to Google Analytics 4 before July 1, 2023.

If you have an existing Universal Analytics property, you will most likely want to use the GA4 Setup Assistant to create a new Google Analytics 4 property that is connected to the old one. The GA4 Setup Assistant does not backfill your new GA4 property with historical data. Your GA4 property only collects data going forward. To see historical data, use the reports in your Universal Analytics property.

How to add Google Analytics to your site 

Choose a Google account to log into Analytics

You will need a Google account to use Google Analytics. You may associate multiple accounts with the administration of a Google Analytics property. Your options for obtaining an account are:

  • Recommended: Use a Service Account. Signup for a new service account or use an existing one. Make sure the account is enabled for Google Apps. Move on to Step 2. The advantage of using a service account is that the account is not decommissioned when an individual leaves the University.
  • If you already have a Princeton University Google account, and you would like to use that account, you are welcome to do so. Make sure the account is enabled for Google Apps. Move on to Step 2.
  • If you would like to create a new non-Princeton Google account for only this purpose, you can do so for free on Google's Account Creation page, then move on to Step 2 below.

Get a Google Analytics tracking or measurement ID

Instructions for Google Analytics 4

This is the latest version of Google Analytics. Follow the instructions for Drupal from Google's help page to set up a property and obtain your Measurement ID. You will need this measurement ID for the next step. 

Once you set up your GA4 property, the Stream ID is prominently displayed, but this number will not work as a tracking number. Instead, you will need to click on Data Streams on the property admin page. If you converted a Universal Analytics property, there should already be a stream listed under "All" or "Web." In the pop-up dialog, you will need to copy the Measurement ID, as seen in the example screenshot below.

Screenshot of the Google Analytics stream details, with Measurement ID highlighted

For a brand new property, click the "Web" button under "Choose a Platform," then enter in the site's URL and name to set up your new Data Stream.

Screenshot of the Google Analytics data stream setup page

Instructions for Universal Analytics

Universal Analytics is the older version of Google Analytics. WDS does not recommend creating new tracking properties with this version because Google is forcing everyone to upgrade to Google Analytics 4 by July 1, 2023.

Add the tracking/measurement ID to your site

  1. From the Admin menu, select the Configuration » Systems » Basic Site Settings 
  2. Paste/Enter your Google Analytics Measurement ID (Google Analytics 4 begins with "G-") or Tracking ID (Universal Analytics begins with "UA-").
     
    Google Analytics Property/Measurement ID
  3. Click Save Configuration
  4. After the number has been added and Google has indexed the website, you can log in to your Google Analytics account to start seeing the statistics for your website.

Analytics reporting

How to Recover a Google Analytics Account

Please Note: WDS does NOT keep track of your user name and password to access your Google Analytics account. It is your responsibility to manage this information. If you have staff turnover, please be sure to transfer this knowledge accordingly.