home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (README.txt)

This example Drupal source code file (README.txt) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

analytics, can, custom, directory, file, google, in, is, page, settings, the, to, tracking, user

The README.txt Drupal example source code

// $Id: README.txt,v 2011/02/07 16:56:07 hass Exp $

Module: Google Analytics
Author: Alexander Hass <http://drupal.org/user/85918>

Adds the Google Analytics tracking system to your website.


* Google Analytics user account

* Copy the 'googleanalytics' module directory in to your Drupal
sites/all/modules directory as usual.

In the settings page enter your Google Analytics account number.

All pages will now have the required JavaScript added to the
HTML footer can confirm this by viewing the page source from
your browser.

New approach to page tracking in 5.x-1.5 and 6.x-1.1
With 5.x-1.5 and 6.x-1.1 there are new settings on the settings page at
admin/settings/googleanalytics. The "Page specific tracking" area now
comes with an interface that copies Drupal's block visibility settings.

The default is set to "Add to every page except the listed pages". By
default the following pages are listed for exclusion:


These defaults are changeable by the website administrator or any other
user with 'administer google analytics' permission.

Like the blocks visibility settings in Drupal core, there is now a
choice for "Add if the following PHP code returns TRUE." Sample PHP snippets
that can be used in this textarea can be found on the handbook page
"Overview-approach to block visibility" at http://drupal.org/node/64135.

Custom variables
One example for custom variables tracking is the "User roles" tracking. Enter
the below configuration data into the custom variables settings form under

Slot: 1
Name: User roles
Value: [user-role-names]
Scope: Visitor

More details about Custom variables can be found in the Google API documentation at

Advanced Settings
You can include additional JavaScript snippets in the custom javascript
code textarea. These can be found on the official Google Analytics pages
and a few examples at http://drupal.org/node/248699. Support is not
provided for any customisations you include.

To speed up page loading you may also cache the Analytics ga.js
file locally. You need to make sure the site file system is in public
download mode.

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal README.txt source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.