How to change GA account number per hostname / domain
Last modified: October 4, 2009 - 10:21
In rare situations you may like to use different Google Analytics user account (UA-1234-1) numbers on your site. By adding the below code snippet to your sites [settings.php] your are able to override the UA account per hostname.
<?php
// Override Google Analytics account number per hostname. Hostnames need to be lower-case!
switch ($_SERVER['HTTP_HOST']) {
case 'www.example.com':
case 'www.example.net':
case 'forum.example.net':
$conf['googleanalytics_account'] = 'UA-123456-2';
break;
case 'www.example.org':
$conf['googleanalytics_account'] = 'UA-123456-3';
break;
default:
$conf['googleanalytics_account'] = 'UA-123456-1';
}
?>
More info about this
People, note that this is also a "feature request" for the Google Analytics module in this thread:
http://drupal.org/node/132650
You also may find a lot of info about this, there.
See you,
Claudio Abraham
mrbrowny in Drupal
From Argentina