How to Implement Google Analytics in Drupal
Posted: March 24, 2017 at 12:16 pm, Last Updated: August 29, 2017 at 2:51 pm
The most common way to implement Google Analytics in Drupal is by using the Drupal Google Analytics module. (Note that this Drupal module comes pre-installed on Drupal websites created by the Office of Communications and Marketing.)
This module provides an interface within your Drupal administration area which allows you to integrate the Google Analytics script in your website’s pages automatically, while providing a number of customization options.
Configuring the Drupal Google Analytics Module
Step 1: Access the Drupal Google Analytics Module
Step 2: Provide the Google Analytics Web Property ID
Provide the Google Analytics Web Property ID to which you would like the website to send its tracking data.
You can find the web property ID in your Google Analytics administration setting.
//Implement George Mason University Analytics Roll-Up Property ga('create', 'UA-1007599-1', 'auto', 'rollUp_Mason'); ga('rollUp_Mason.send', 'pageview'); //Implement department-level roll-up ga('create', 'UA-XXXXXXXX-X', 'auto', 'rollUp_department'); ga('rollUp_department.send', 'pageview');