It is not clear from README.txt file how to setup the module for two separate Drupal installations like http://mysite.com and https://sub.mysite.com I have activated the module on the main site, specified "Web Property ID" from Google and checked "One domain with multiple subdomains" option.
What about second subdomain site? Do I need to activate the module there too? DO I need to write the same "Web Property ID"? What about setting "What are you tracking?:" under Domains section? If I check "One domain with multiple subdomains" option, then it seems it will try to track the subdomains of my subdomain.
Reading http://www.google.com/support/analytics/bin/answer.py?answer=174090 also does not help, since we need to setup Google Analytics module for Drupal.
Comments
Comment #1
hass commentedWith independent databases, also configure the subdomain site like your main site. Both need to show the ".domain setting in footer
Comment #2
yngens commentedThanks, but which one of two settings I should select for subdomain?
What are you tracking?:
A single domain (default)
Domain: sub.mysite.com
One domain with multiple subdomains
Comment #3
hass commentedDepends on how you'd like to track. All sub and main domains in one singe account - use the second selection. Google Docs are very clear... And there is nothing special in drupal
Comment #5
burningdog commentedMy issue is the same as this post, and #3 didn't clear it up for me.
I have an existing drupal site, www.example.com, which is being successfully tracked by GA. I've just created a new drupal site, a subdomain - blog.example.com - which needs to be tracked.
According to http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#... the following code needs to be present on both sites:
On the subdomain site, I've configured the GA module to "One domain with multiple subdomains", which is currently the only way to get
_gaq.push(["_setDomainName",into the javascript.Taking a look at the module code (line 233):
Unfortunately,
_setDomainNamegets set to$cookie_domain, the value of which on the subdomain is.blog.example.comHowever, I expect it to be
.example.comas I shouldn't need to change my $cookie_domain to beexample.comin settings.php for the subdomain drupal site.I would suggest the following: keep the current behaviour as the default, but if a user has entered in a value to the "List of top-level domains" textarea then use the first one as the value for _setDomainName
Is that a decent solution? Even better, add a textarea/texbot below the "One domain with multiple subdomains" radio where a user can enter their top level domain.
Comment #6
hass commentedFirst of all open your settings.php on both sites and setup your
$cookie_domaincorrectly:This should fix the issue for both sites.
If you think you need to run both sites in-depended with unique cookies/sessions, set up GA with A single domain (default) and add the
_setDomainNameline manually in Custom JavaScript code > Code snippet (before).Comment #8
burningdog commentedThanks hass - #6 did the trick. I set $cookie_domain = "example.com" in the sub-domain site (I didn't change that value on the main site). Then I set the GA tracking option to "One domain with multiple subdomains" at admin/config/system/googleanalytics
Comment #9
satvision83 commentedI have a question:
If the main website is www.website.com and subdomain is www.sub.website.com, in settings.php on www.sub.website.com the line #$cookie_domain = 'example.com'; i have to set to $cookie_domain = 'website.com'; ? Is that right?
This is my issue: http://drupal.org/node/1832048
Comment #10
user654 commented.
Comment #11
rohr commentedNote for beginners - you may need to allow for "write" capability in the file permissions of settings.php before attempting to edit this file.
Comment #12
rohr commentedPlease note that subdomain support is already built into the newer Google "Universal" Analytics and does not require different code. Great article here on Google Analytics filters to track subdomain traffic and make sure that this is working as expected: http://www.wearefine.com/mingle/subdomain-tracking-with-universal-analyt... Also, data may take up to 48 hours to start showing in the Google Analytics dashboard.