Setting Up Google Analytics and Integrating It with Google Tag Manager

This document assumes some basic familiarity with Google products. In particular you will need to know the basics of navigating the admin dashboard for both Google Analytics as well as Google Tag Manager. If you are not familiar with them we recommend you begin reviewing this documentation first: 

Part 1: Setting Up Google Analytics Property

  1. Sign in to Google Analytics:
    • Go to Google Analytics and sign in with your Google account. If you have multiple accounts make sure the one you want associated with the property is active. 
  2. Create a New Property:
    • Click on the “Admin” gear icon in the lower-left corner.

or

  • In the “Admin” section, select the “Create” button.
  • In the dropdown, click on “Create Property.”
  • Enter the property details:
    • Property Name: Enter a descriptive name for the property (e.g., “My Website Analytics”).
    • Reporting Time Zone: Select your time zone.
    • Currency: Select your currency.
  • Click “Next.”
  • You may be asked to enter business details and objectives after this. This will depend on your particular needs but we typically recommend going with “Jobs & Education” for industry category. Then “Very Large” for business size. Finally for business objective yours may be different but we suggest “Get baseline reports” but you should choose what fits your needs. 
  1. Set Up Data Collection:
    • Select “Web” for the data stream type.
    • Enter the URL of your website and give the stream a name (e.g., “My Website Stream”).
    • Click “Create Stream.”
    • You will be prompted to set up a google tag. You can ignore this for now as we will create that later. Close the pop up.
  2. Configure the domains that will be tracked using this Google Analytics tag. (Optional)
    • On the Web stream details page, scroll down and click Configure Tag Settings.
    • Click Configure Your Domains.
    • Click Add Condition, then set Match Type to Exactly Matches. In the second field, enter the domain (e.g., cms.ubc.ca). Do not include https:// or any slashes (/). If your site is hosted on UBC CMS, the domain would look like something.ubc.ca. If your site is hosted on UBC Blogs, please use blogs.ubc.ca.
  3. Get the Measurement ID:
    • After creating the stream, you will see a Measurement ID (e.g., G-XXXXXXXXXX). Note this ID as you will need it later.

Part 2: Integrating Google Analytics with Google Tag Manager

  1. Sign in to Google Tag Manager:
  2. Create a New Account/Container:
    • If you don’t have a account or container for your website, click “Create Account.”
    • Enter the account name (e.g., “My Website Tag Manager”).
    • Select Country
    • Container name
    • If you have an account already look for the gear icon in the upper right corner for the account you want to create the new container in and click it.
    • Enter the container name (e.g., “My Website Container”) and select “Web” as the container type.
    • Click “Create” and accept the terms of service.
    • Close the pop up as we will not be manually installing the tag code.
  3. Set Up Google Analytics Tag:
    • In your GTM workspace, click on “Tags” in the left-hand menu.
    • Click “New” to create a new tag.
    • Click on “Tag Configuration” and select “Google Analytics” and then select the Google Tag option. 
    • Enter your Measurement ID from Google Analytics.
  4. Set Up Triggering:
    • Click on “Triggering” and select the “All Pages” trigger. This ensures that the Google Analytics tag will fire on all pages of your website.
    • Click “Save” to save your tag configuration. You may be prompted to rename this tag. We recommend a descriptive name like “google analytics”.
  5. Previewing Your Container 
    • After setting up the tag, it’s time to test it to ensure everything is working before you submit the updated tag set up. Click the “Preview” button in the upper-right corner. 
    • You will be prompted to enter a website url to preview your container. 
    • Once entered you will see your site in a new window. Clicking through different pages should fire your google analytics and if you go back to the window tag assistant it will show if your tag has fired. Once you have confirmed it is working you are ready to submit. 
  6. Publish Your Container:
    • After setting up the tag, click “Submit” in the upper-right corner.
    • Enter a version name and description (e.g., “Initial Setup for Google Analytics”).
    • Click “Publish” to publish your container.

Part 3: Getting the GTM ID for WordPress Integration

  1. Find Your GTM Container ID:
    • In your GTM workspace, click on the container name in the top bar to open the container settings.
    • You will see the GTM Container ID in the format GTM-XXXXXXX in the top-right corner of the screen. Note this ID as you will need it for the WordPress plugin.
  2. Enter the GTM ID in WordPress:
    • Log in to your WordPress admin dashboard.
    • Navigate to Plugins. Find and activate the ‘GTM4WP‘ plugin.
    • Navigate to the settings of the plugin for Google Tag Manager. Typically it will be at /wp-admin/options-general.php?page=gtm4wp-settings
    • Enter the GTM Container ID (GTM-XXXXXXX) into the appropriate field in the plugin settings.
    • Set ‘Container code ON/OFF’ to ‘On’.

After completing the setup, it may take up to 24 hours for data to appear in your Google Analytics property. Changes in Google Tag Manager take effect immediately after publishing, so your tag should be working, but you may need to wait to see the results in Google Analytics. If issues persist, consider alternative solutions similar to what is outlined here.