Currently I am using Google Analytics on this website. Google Analytics is a pretty advanced solution for monitoring the website visits.

When activating the Google Analytics account, you will get the advice to copy/paste some PHP code into your site. It is not necessary to do that, you can use the Drupal module google_analytics.

Configuring the Google Analytics module

To configure this module go to menu:

Home » Administer » Site configuration » Google Analytics

Here you can fill in the Google Analytics account number:

UA-XXXXXXX-1

And I also selected the following options:

  • Track outgoing links
  • Track mailto links
  • Track download links

Click on ‘Save configuration’ and you are ready.

Multi-site configuration

The Google Analytics Drupal module does not work by default in multi-site configurations (see Drupal multi-site installation), but it is easy to adapt for this.

Open /sites/default/settings.php and insert the following piece of PHP code into this file:

switch ($_SERVER['HTTP_HOST']) {_

case 'yourdomain-one.com':
    $conf['googleanalytics_account'] = 'UA-XXXXXXXX-1';
    break;

case 'yourdomain-two.com':
    $conf['googleanalytics_account'] = 'UA-XXXXXXXX-2';
    break;

default:
    $conf['googleanalytics_account'] = 'UA-XXXXXXXX-1';
}

You have to modify the yourdomain and UA-XXXXXXXX-1 parts into your domain and account values.