Skip to content

Google Analytics Setup

Completing Google Analytics setup requires access to Google Analytics and [Google Tag Manager]. Please submit a service request if you need access added to your JAX account.

These instructions are based off of Google's support documentation for setting up Google Analytics (GA4). Additional details and links to other resources can be found there.

Google Analytics is a suite of analytics tools for analyzing website usage. The other product in use for web analytics in Computational Sciences is Application Insights. Click here to get to the Google Analytics site.

Google Tag Manager is a tag management system that allows you to create measurement codes and code fragments on your website. A tag will be needed in order to send user interaction data to Google Analytics. Click here to get to the Google Tag Manager site.

Create a New Property

The first step is to create a new property in Google Analytics. A property adds an indentifier to the analytics data that is captured from users interacting with web pages. To create the property do the following steps:

  1. Navigate to the Admin console by clicking on the gear icon at the bottom of the left navigation panel.
  2. Make sure JAXCompSci is the selected account in the left panel of the admin console.
  3. At the top of the right panel click the Create Property button
  4. Give your property a name (e.g. the name of your application), select the New York time zone, and click Next
  5. Select Science for industry category and Very Large business in step 2 and click Next
  6. In step 3 check the option Examine User Behavior and then click Create
  7. To start the next section click the Web option

Set Up a Data Stream

In order to start collecting information you will need to set up a data stream. If you are not coming directly from the previous step start by going to the Google Analytics Admin console and choose the property for which you need to create the Data Stream. Next click Data Streams from the menu. From here click the Add stream drop down menu and choose Web.

  1. Enter your domain in the Website URL section and give the stream a name such as the name of the web application
  2. Click Create stream and the installation instructions should appear which you will need later. You can get back to the instructions from the stream details page by choosing the Configure tag settings option and then the link to Installation Instructions. Select the Install Manually tab instructions.

Create a Tag

  1. Navigate to Google Tag Manager
  2. Under The Jackson Laboratory account click on the extended list (vertical ellipses) and choose Create New Container
  3. On the Create Container page enter your container name and select Web for the Target Platform then click Create
  4. In the Workspace page select Add a new tag
  5. Click the Tag Configuration section to select a tag type. Choose Google Analytics: GA4 Configuration for the tag type then get the measurement ID from the installation instruction for the property you created in Google Analytics
  6. Click the Triggering section to choose a trigger. Select All Pages and then click Save in the upper right of the panel
  7. Give the tag a name (e.g. GA4 Config - {measurement ID})

Release the Tag Manager Container

  1. From the Tag Manager Workspace click the Submit button in the upper right.
  2. Selection the Publish and Create Version Option
  3. Add a version number (e.g. 1.0.0) and a description of the changes (e.g. Created GA4 Tag) and click Publish

Update Your Angular Application

  1. Open the Installation Instructions from the Set Up a Data Stream section above
  2. Copy the code to your index.html page as instructed
  3. You will need to update the content security policy settings to allow analytics data to be sent to the service. To do this you will need to add https://www.google-analytics.com as a value to the connect-src directive.
  4. Deploy the application in any environment (including locally) and you should see a GET request to www.googletagmanager.com to load the javascript for the tag and a POST request to www.google-analytics.com where the analytics data is submitted to.

Note

It can take up to 48 hours for the configuration of Google Analytics and Tag Manager to be fully available.