# Google Analytics code for Different Domains?

**URL:** <https://www.ruby-forum.com/t/google-analytics-code-for-different-domains/157590>\
**Category:** Rails\
**Created:** [January 13, 2009, 12:23pm UTC](https://www.ruby-forum.com/t/google-analytics-code-for-different-domains/157590 "2009-01-13T12:23:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![srinathbtech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7bcc69/32.png) [@srinathbtech](https://www.ruby-forum.com/u/srinathbtech)\
**Post date:** [January 13, 2009, 12:23pm UTC](https://www.ruby-forum.com/t/google-analytics-code-for-different-domains/157590/1 "2009-01-13T12:23:09Z")

</div>

Hi,  
How to track the pages for different domains, i have 2  
domains([www.domain1.com](http://www.domain1.com) and [www.domain2.com](http://www.domain2.com)) pointing to same  
application.  
What modifications should i do in Environment.rb file, is it i need to  
keep a condition?  
i was using the code :

# configuring google analytics

Rubaidh::GoogleAnalytics.tracker\_id = ‘UA-5066152-1’  
Rubaidh::GoogleAnalytics.domain\_name = ‘[domain1.com](http://domain1.com)’  
Rubaidh::GoogleAnalytics.environments = [‘production’]

Plz help me !!

thanks,  
sri…

---

<div class="post-metadata">

**Author:** ![srinathbtech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7bcc69/32.png) [@srinathbtech](https://www.ruby-forum.com/u/srinathbtech)\
**Post date:** [January 14, 2009, 11:27am UTC](https://www.ruby-forum.com/t/google-analytics-code-for-different-domains/157590/2 "2009-01-14T11:27:31Z")

</div>

Hi,

Just spotted this on the list too. For the sake of completeness,  
here’s the response I sent to the private email I got asking the same  
question:

I believe there’s a fork of the google analytics plugin which supports  
multiple domains. Check out:

[GitHub - albanpeignier/google\_analytics: Automatically insert Google Analytics code into your pages](http://github.com/albanpeignier/google_analytics)

I haven’t thought of a clean way to merge it in that doesn’t break  
backward compatibility yet, which is why I haven’t pulled the fork  
back into master.

G

On Jan 13, 11:23 am, “Srinath A.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
