First, what is 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)

If implemented correctly, Google Analytics can be turned into a powerful business intelligence tool. This quick tutorial will get you up and running with Google Analytics on your Drupal installation by using Google Analytics Module for Drupal.

Step One

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 your account in the admin section of Google Analytics. Now you can get your “Tracking ID” under the "Property Setting" section; it should look something like, “UA-52008693-1”.


How to Get Google Analytics Tracking ID


Step Two

Now we head back to our drupal site and install the Google Analytics module. Once you have enabled the module, you can access its configuration page by going to "Configuration". Under the "General Setting" section, you can enter the "Web Property ID", which is the "Tracking ID" we have created in Google Analytics.


How to add google analytics web property id


Step Three

You can go ahead and save your settings. For most users, Google Analytics module's default setting should get them started. For advanced users, this module offers some top-notch features. Let me give you a quick overview of these features without going into too much details.

Going through different tabs in the "Tracking Scope", we have the following options:

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

Pages - This setting lets you select which pages you intend to track. You can provide a list of pages and 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 or her to opt-out of tracking.

Google Analytics user profile configurations


Messages - This helps you track the messages shown to the users.

Search and Advertising - This lets you track your internal site searches 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.


I hope that this tutorial has given you some ideas on how you can utilize the Google Analytics module in Durpal to generate some insights for your website. And if you wish to learn more about this module, such as adding custom variables and configuring your javascript setting, feel free to read the module documentation for more details.


Read Next

Versioning SOAP Web Services in Mule using CBR and CXF Proxy

14 July, 2014|5 min