Вопрос

I want to get the GA data with this setup:

  • Main domain: mydomain.com
  • Second domain: subdomain.myotherdomain.com/myfolder

So basically I want the visits to the main domain and the visits to the second domain to count as one page. The reason for that second domain is to redirect user to a secure area. That secure area is located in a subfolder, not in the root of the second domain.

I thought that as long as I put the same tracking ID everywhere it would be fine, but donig some research I found this from Google: Set up cross-domain tracking for multiple domains

Do I need this in my case? If so, how do I tell GA about just tracking the specific folder in the second domain? I will have other folders in the future that will need to be tracked separately from this account, so that's why I only want that folder...

Это было полезно?

Решение

Yes, you do need this (or else visits from mydomain.com to myotherdomain.com will be counted as two different visitors with mydomain.com as refering site).

You can use _setCookiepath (in the code for myotherdomain.com ) to limit the Google Analytics cookie to your subdirectory:

_gaq.push(['_setCookiePath', '/myfolder']); 

(https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._setCookiePath)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top