Google Analytics

Using this feature requires you to already have an account with Google Analytics.

Locate your Google Analytics ID from your GA account

The GA4 ID, added to SiteFarm in August 2022, allows for the co-existence of your original Universal Analytics ID (UA) and the GA4 ID. The details of the change are described in our blog post "Google Analytics 4 coming to SiteFarm" and in much greater detail in the MeasureSchool article "How to upgrade to Google Analytics 4".

  1. Log into your Google Analytics account.
  2. In the upper lefthand corner of your account screen, directly to the right of the Analytics logo, locate and click on the All accounts > (property name) button.
  3. From the pop-up window, select one of your site properties and open it.
  4. From the menu panel on the left side of the screen, look to the bottom left corner and click on the cog icon (Admin).
  5. In the Property column, click on the fourth entry: Data Streams.
  6. Click on your G4 entry.
  7. The main Stream Details will include:
    • Stream name
    • Stream URL
    • Stream ID
    • Measurement ID <-- this is your G4 ID to be used in your SiteFarm site.

How to add one or more Google Analytics property IDs

Once you have followed the instructions to create a new GA4 ID and, if needed, link it with your already existing UA ID, you can then add the ID to your SiteFarm site.

  1. Navigate using the Admin panel to Manage » Configuration » Web Services section » Google Analytics.
  2. If you already have an existing UA ID, it will already be displayed in the interface. Proceed to the next step. If you are starting off with only the GA4 ID, paste or type it into the Web Property ID(s) field, then proceed to step 4.
    A screenshot of the Google Analytics Property ID screen where users can enter in their ID codes to link their site traffic to their Google Analytics account.
    Click the Add another ID to add a new field line
  3. Click the Add another ID button so a second field is available under your UA ID. Paste or type your GA4 ID into this new field.
  4. Scroll to the bottom of the screen and click Save configuration to finish.

"I can't remove the ID" - A workaround for the ID requirement

As of this writing in October 2022 a design choice in the latest version of the Google Analytics module makes the inclusion of an Analytics ID a requirement, so the field cannot be left empty. A request to review and change this requirement has been sent to Drupal.org. Should you need to replace a site due to a redesign, or clone an existing site to create a new site or a dev/sandbox, you can work around this requirement by replacing the real ID with a dummy placeholder, such as UA-99999999999999.

 

Additional settings available for configuration

Domain Tracking

What are you tracking? 

  • A single domain (default)
    Domain: sitefarm.ucdavis.edu
  • One domain with multiple subdomains
    Examples: www.example.com, app.example.com, shop.example.com
  • Multiple top-level domains
    Examples: sitefarm.ucdavis.com, sitefarm.ucdavis.net, sitefarm.ucdavis.org

List of top-level domains (EXAMPLE of "one domain with multiple subdomains")

vmth.vetmed.ucdavis.edu
cfah.vetmed.ucdavis.edu
vmb.vetmed.ucdavis.edu

If you selected "Multiple top-level domains" above, enter all related top-level domains. Add one domain per line. By default, the data in your reports only include the path and name of the page and not the domain name. For more information see section Show separate domain names in Tracking Multiple Domains.

Pages

Add or Exclude tracking for specific pages.

  •  Every page except the listed pages
  •  The listed pages only

Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are /blog for the blog page and /blog/* for every personal blog. <front> is the front page.

Here is the list of pages already excluded from tracking:

  • /admin
  • /admin/*
  • /batch
  • /node/add*
  • /node/*/*
  • /user/*/*

Roles

Add or Exclude tracking for specific roles.

You can choose to add tracking to the role(s) you select, or add tracking to every role except the ones you select. The available roles to track or exclude include:

  • Anonymous user
  • Authenticated user
  • Contributor
  • Editor
  • Site Manager
  • Administrator
  • Site Builder

If none of the roles are selected, all users will be tracked. If a user has any of the roles checked, that user will be tracked (or excluded, depending on the setting above). We recommend only tracking the Anonymous user type.

Users

Allow users to customize tracking on their own user account pages.

Links and Downloads

  • Track clicks on outbound links
  • Track clicks on mailto links
  • Track downloads (clicks on file links) for the following extensions
    A file extension list separated by the | character that will be tracked as download when clicked. Regular expressions are supported. For example: 7z|aac|arc|arj|asf|asx|avi|bin|csv|doc(x|m)?|dot(x|m)?|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt(x|m)?|pot(x|m)?|pps(x|m)?|ppam|sld(x|m)?|thmx|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls(x|m|b)?|xlt(x|m)|xlam|xml|z|zip
  • Track content in colorbox modal dialogsEnable to track the content shown in colorbox modal windows.
  • Track enhanced link attribution
    Enhanced Link Attribution improves the accuracy of your In-Page Analytics report by automatically differentiating between multiple links to the same URL on a single page by using link element IDs. Enable enhanced link attribution in the Admin UI of your Google Analytics account.
  • Track changing URL fragments as pageviews
    By default, the URL reported to Google Analytics will not include the "fragment identifier" (i.e. the portion of the URL beginning with a hash sign), and hash changes by themselves will not cause new pageviews to be reported. Checking this box will cause hash changes to be reported as pageviews (in modern browsers) and all pageview URLs to include the fragment where applicable.

Track Messages of a Type

  • Status message
  • Warning message
  • Error message

This will track the selected message types shown to users. Tracking of form validation errors may help you identifying usability issues on your site. For each visit (user session), a maximum of approximately 500 combined GATC requests (both events and page views) can be tracked. Every message is tracked as one individual event. Note that - as the number of events in a session approaches the limit - additional events might not be tracked. Messages from excluded pages cannot be tracked.

Search and Advertising

  • Track internal search
    If checked, internal search keywords are tracked. You must configure your Google account to use the internal query parameter search. For more information see Setting Up Site Search for a Profile.
  • Track AdSense ads
    If checked, your AdSense ads will be tracked in your Google Analytics account.
  • Track display features
    The display features plugin can be used to enable Display Advertising Features in Google Analytics, such as Remarketing, Demographics and Interest Reporting, and more. Learn more about Display Advertising Features in Google Analytics. If you choose this option you will need to update your privacy policy.

Privacy

By default, visitors' IP addresses are made anonymous in SiteFarm. Tell Google Analytics to anonymize the information sent by the tracker objects by removing the last octet of the IP address prior to its storage. Note that this will slightly reduce the accuracy of geographic reporting. In some countries, it is not allowed to collect personally identifying information for privacy reasons and this setting may help you to comply with the local laws.