amariotti.com

  • about
  • blog
  • modules
  • portfolio
  • resumé
  • contact
Home › Blogs › amariotti's blog

Recent blog posts

  • Reverse NodeReference Block - Revisited
  • CS4 Keyboard Issues
  • Text Formatter Module
  • Cool Apache ReWrite Trick
  • New RSS Feed
  • Find My iPhone
  • Congratulations, Drupal!
  • Re-Launched on Drupal 6
  • Copying + Pasting from Word into Drupal
  • Page Not Found on Node Creation
more

Blog tags

cck drupal drupal 6 drupal issue liquidweb module modules that I love os x random review views xbox
more tags

Multiple Google Analytics Accounts with the Domain Access Module

amariotti — Wed, 01/14/2009 - 17:08

A month or so ago I started my first site on Drupal 6.x. I was very excited about this for a number of reasons which I will mention on another day–in another post. Once it was installed I went straght for the Domain Access module. For those of that are familiar with it, you know that it's a pretty slick module with a lot of good functionality. It allows you to run multiple Drupal 6 sites off the same code base and database. I understand that there is always the multi-site option, but I wanted to try something a little more integrated and clean. That's all I'll say about the Domain Access module (I will post about it in the next few weeks, because there's lots to say).

Anyway, so say that you wanted to use the Domain Access module with multiple-sites/sub-domains but you wanted them each to have a different Google Analytics Account Number (UA-xxxx-x)? My reasoning for this was so that I could track my sites totally independent of each other. Google added a feature that will allow you to seperate your analytics by domain name, which works, but wasn't the solution I wanted. Then it was time for digging.

I came across a post of Drupal.org that gave me a good start. I had to keep searching for a few days (on and off) before I was able to find a post that almost got me there. And finally, after a few typos in the function, it all came together. And here's how you can do it on your Drupal 6.x, or 5.x if I remember correctly, site.

Create a domain_conf.inc file in your /sites/all/modules/domain/domain_conf folder. The function can be found in the attached txt file on this post.

After you follow those steps be sure and enable the "Domain Configuration" module on your modules page. Once it's enabled you will see a new field (shown below) show up on your domain's settings page at: admin/build/domain/conf/(domain id).

Then you're done! Enjoy!

AttachmentSize
domain_conf.inc.txt1.08 KB
  • drupal
  • module
  • amariotti's blog
  • 5145 reads
  • about
  • blog
  • modules
  • portfolio
  • resumé
  • contact