Some groups my choose to track user visits to their site. We support two options: Google Analytics (useful for anyone) and Facebook Analytics (useful for those buying paid Facebook ads for their site's content). This page is primarily about setting up Google Analytics; more info about Facebook is at the bottom of this page.
For personal sites, you should use your personal, non-Caltech email address to create a Google Analytics account. Institute policy does not allow you to use Google Analytics with your normal Caltech email address (e.g firstname.lastname@example.org).
For a department site, you should follow the instructions on the IMSS web site and request a "club account" to create an email address your group can use to manage your Google Analytics. Then use that address to sign up for a Google Analytics account. Using a separate email address makes it easier to share responsibility for the Google Analytics account.
As of May 2022, there are two different ways to set up a Google Analytics account: Universal Analytics (the old way) and Google Analytics 4 (the new hotness). We encourage groups who are setting up new sites to use Google Analytics 4. Instructions for how to set up for Universal Analytics are still provided lower on this page, but will likely be entirely obsolete by July 2022
Google Analytics 4
To set up a Google Analytics 4 property to track your site's viewers, follow these instructions from Google. Note that you cannot use your personal Caltech email address for creating an account, so use either a personal gmail account (for personal site) or a departmental Google account (set up using the description above) for a department site.
Create a "Web" Data Stream for your website's domain. When you get to the "Set up data collection (for websites)" section, click the icon next to the "Measurement ID" near the top-right to copy it into your clipboard (or just select and copy the ID manually).
Then log in to your Caltech Sites admin console. Go to the Settings -> Site Preferences page, choose the Analytics tab, and paste the copied Measurement ID into the "Google Analytics 4 Tracking ID" field. Then click the green Save button. The value that you pasted should look something like G-ABC####XYZ.
Placing your Measurement Id in your site's preferences takes the place of the "Set up data collection (for websites)" section of the Google instructions. Google Analytics will begin tracking visits to your site, which you can view from the Google Analytics homepage. You should be able to see some data in the "real time" section if you click around on your web site. But most of the reports will not have enough data to display until tomorrow or later in the week.
Universal Analytics (old style)
To collect analytics via Google Analytics, you will need to create a Google analytics account and follow the instructions on this page to obtain a Universal Analytics tracking id. The id you need will be in the "Property Settings" section of your analytics admin interface and should be formatted as "UA-<7digits>-1". Once you have that tracking id, you can copy it into the "Google Universal Analytics Tracking ID" field in the Universal Analytics section of the Site Preferences Analytics tab.
If you would like to use the full power of Google Analytics (filtering, tracing user sessions, etc.), you will want to monitor your site on https://analytics.google.com/ so there is no need to enter the "Google Analytics View ID" or the "Google Analytics Private Key JSON File". Those are used if you want to view a limited set of analytics from within the admin interface of your site.
Google Tag Manager and Facebook Pixel
The Analytics settings tab has fields for you to enter a Google Tag Manager ID and/or a Facebook Pixel ID. These are both advanced analytics tools that require a fair amount of expertise to use effectively. Assistance with these tools is beyond the scope of support IMSS can provide.