Entity view (Content)

How to Setup Google Analytics for Drupal

By skabir
Jun. 18, 2014


What is this Google Analytics?

Google Analytics is a service offered by Google that generates detailed statistics about a website's traffic and traffic sources and measures conversions and sales. The product is aimed at marketers as opposed to webmasters and technologists from which the industry of web analytics originally grew.(Wikipedia)

This quick tutorial will get you up and running with google analytics on your drupal installation. We will be using Google Analytics Module for Drupal. If you don’t have a google analytics account you will need to sign up for one and add your drupal website to it. Once finished, your site should show up as a property under account in the admin section of google analytics. Now you can get your “Tracking id” by clicking on property setting, it should look something like, “UA-52008693-1”.


How to Get Google Analytics Tracking ID


Now we go to our drupal site and install Google Analytics Module. Once you have enabled the module you can access its configuration page by going to Configuration and then Google Analytics. Under the ‘General Setting’ section you can enter the ‘Web Property ID’, which is the ‘Tracking ID’ we got from Google Analytics admin section.


How to add google analytics web property id


You can go ahead and save your settings. For most users google analytics modules default settings should get them started. For advanced users this module offer some very awesome features. We would give you a quick overview of these features without going into much details. Going through different tabs in the ‘Tracking Scope’ we have the following options,

Domains - This setting lets you select what we are tracking, for e.g single or multiple domains.

Pages - This setting lets you select which pages we actually want to track. You can provide a list of pages/paths that you want or don’t want to track.

Roles - This setting lets you choose what roles we want to track or not track.

Users - This is an interesting setting for those sites that have strict privacy policies. This option allows the site users to opt out of tracking depending on the option selected. In order to make this work you will have to change permissions under google analytics and allow users to ‘Opt-in or out of tracking’. This will show a checkbox in user profile that would allow him to opt-out of tracking.
[picture - Google Analytics User Profile Configuration image]

Messages - This helps you in tracking the messages shown to the users

Search and Advertising - This lets you track your internal site search and AdSense advertisements in your google analytics. Some additional settings might be required.

Privacy - This setting lets you anonymize visitors IP addresses and also respect do not track policy.


This module also allows you to add some custom variables and configure your javascript setting, you can learn more about those settings in the module documentation.


Post Tags: