Google Analytics

About Google Analytics

Google Analytics is a web analytics service offered by Google that tracks and reports website traffic. Google Analytics is the recommended tool to track user interaction and collect basic data from your website. If you want to learn more about Google Analytics, visit the University's training website (login required) and search for "Google Analytics Essential Training." You can also follow their instructions titled "Get Started with Google Analytics".

Important: It is the department's responsibility to create and manage your google analytics account including the login credentials. WDS does not keep track nor has access to your google analytics account.

We strongly suggest that you create your google analytics account with your department service account (ie. and not with a personal or work gmail account). Also, it is important to maintain the login credentials and transfer this information in cases of staff turnover. University supported password manager LastPass may be a useful tool for this.

Important note about Google Analytics 4

The newer version of the Google Analytics tracking numbers are not compatible with the current version of the Google Analytics module for Drupal. You must use the legacy Universal Analytics number, which starts with a "UA-" prefix. For more details, read Step 2 below.

The Site Builder version 1 platform will not be upgraded to support Google Analytics 4 tracking numbers. However, a future monthly release will add this support to Site Builder version 2.

How to add Google Analytics ID to your site

Step 1: Create a Google account to log into Analytics

You will need a Google account to use Google Analytics. Your options for obtaining an account are:

  1. Recommended: Use a Service Account. Signup for a new 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.
  2. 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.
  3. If you would like to create a new non-Princeton Google account for only this purpose, you can do so for free at then move on to Step 2 below.

Step 2: Get a Google Analytics tracking ID (UA number)

  1. Visit to log in (or register if this is the first time using Google Analytics with this account). 
  2. Once you are successfully logged in you will need to follow these instructions to set up a property and generate your tracking ID.
  3. This tracking ID is part of the tracking code that is inserted in the source code for your site.  The tracking ID, sometimes called a "UA number," needs to have a format similar to "UA-12345678-9." Copy this number.
  4. Please note that Google will encourage you to create a next-generation "Google Analytics 4" property. These newer tracking numbers are not compatible with our Drupal systems and might look like the following:
    1. One that starts with a "G-" prefix (Measurement ID)
    2. A 10-digit number with no prefix. (Stream ID)
    3. A 9-digit number with no prefix (Property ID)
  5. Again, none of the newer Google Analytics 4 numbers are compatible with the current version of the Google Analytics module for Drupal. For now, you must use the "Universal Analytics" tracking ID, which starts with a "UA-" prefix.
  6. When creating a new property, make sure you click Show Advanced Options. There is a toggle switch to allow you to create a Universal Analytics property. Go ahead and "Create both a Google Analytics 4 and a Universal Analytics property." You can use the UA number now, and swap it out with the "G-" number when the Drupal module is updated. Within your Google Analytics 4 property, on the "Web stream details" page, the "G-" Measurement ID is prominently displayed at the top. The UA number is hidden under Connected Site Tags at the bottom. You can also access your Universal Analytics property directly from the Accounts menu at the top.

Step 3: Add the UA number to your site

From the Admin menu, select the Configuration option and click Google Analytics on the right-hand side under System.

Analytics image

Paste/Enter your Web Property ID number. If you see the number “UA-53634508-2,” that is a placeholder number, and you should replace it with an ID number that is issued by a Google Analytics account under your control.

Analytics image

After the number has been added and Google has indexed the website, you can log in to Google Analytics to start seeing the statistics for your website.

Analytic reporting

Once Google Analytics and your Drupal website are linked properly, learn to create dashboards and reporting mechanisms in Google Analytics. Common metric reporting can be done on Page Views and Visits.

If you want to see results on a specific page within your website, click on Behavior, and then All Pages

Google Analytics image

Use the Page Title option to find your page

Google Analytics image

Use the Show rows: option to alter your view

Google Analytics image


Make sure the PWDS Analytics feature is enabled in your Drupal administration options. From the Structure option in the Admin menu, select Features.

From the menu on the right, select PWDS. Make sure that PWDS Analytics is enabled in the check box.

Analytics image

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.

External Resources:

Related Links: