Google Tag Manager/Google Analytics

Google Tag Manager, a more recent set of tools that integrate with Google Analytics, provides statistics about page visits, file downloads, and video plays. Setting this up is a two-part process: setting up the reporting in Google and setting the Google Tag Manager ID in the site’s configuration.

Basic configuration

First set up a Google Tag Manager account per Google’s documentation.

  1. Set up and install Tag Manager

  2. Deploy Universal Analytics with Tag Manager

Completing site verification

Setting up Google Tag Manager includes verifying that you are the owner of the site. The Drupal Kit integration does not currently allow verification in Google Search Console, which Google documentation shows as the default verification method.

The easiest workaround is as follows:

  • Make sure the “Metatag Verification” module, included with the Drupal Kit, is enabled on your site.

  • Edit the “GLOBAL” metatag group at Configuration > Metatag (/admin/config/search/metatag/global).

  • Enter the HTML tag value from into the “Google” field of the “SITE VERIFICATION” section.

  1. In your site, go to Configuration > System > Google Tag Manager (/admin/config/system/google_tag).

  2. On the “General” tab, enter the GTM-XXXXXX tracking ID created in Google into the indicated field:

Drupal Kit Google Tag Manager configuration page

The remaining four tabs pertain to advanced configuration. Usually the default settings are sufficient.

  • Page Paths: Include or exclude tracking and analytics based on the page paths.

  • User roles: Include or exclude tracking and analytics based on user roles.

  • Response statuses: Include or exclude tracking and analytics based on the HTTP status of pages (ex. exclude tracking for pages not found, or pages with forbidden access)

  • Advanced: An array of advanced configuration options.