2012-12-04 4 views
1

가능한 중복 계정 :이 질문에 대한 인터넷의 주위에 검색 한
google analytics - multiple trackers on one page (cookie conflict)두 구글 분석 페이지 당

을하지만 캔트 내가 찾고 있어요 답을 찾을 수 있습니다.

몇 가지 특별한 기능이있는 블로그를 개발했습니다. 각 사용자는 등록 할 때 하위 도메인을 갖습니다.

모든 것이 무료이지만 광고가 있습니다. 현재 Google Analytics를 사용하여 총 방문자 수와 페이지 뷰 수를 추적합니다.

저는 각 사용자가 얼마나 많은 방문자와 페이지 뷰를 볼 수 있도록 작은 카운터를 만들었지 만 더 자세한 정보를 얻기 위해 자신의 "Google Analytics"를 사용해야하거나 사용하고자하는 정보를 필요로합니다.

So. 내가 지금 사용하는 코드 :

<script type="text/javascript"> 
     var _gaq = _gaq || []; 
     _gaq.push(['_setAccount', 'UA-xxxxxx1-1']); 
     _gaq.push(['_setDomainName', 'sub.domain.com']); 
     _gaq.push(['_trackPageview']); 

     (function() { 
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
     })(); 
    </script> 

은 내가 그들에게 HEAD 내 자신의 코드를 삽입하자, 각 사용자가 사용하는 분석 서비스의 유형을 잘 모릅니다. Google 애널리틱스를 사용하는 경우 Google 애널리틱스의 두 계정에서 올바른 방문자 수를 얻을 수 있습니까? 이 같은

<script type="text/javascript"> 
     var _gaq = _gaq || []; 
     _gaq.push(['_setAccount', 'UA-xxxxxx1-1']); 
     _gaq.push(['_setDomainName', 'sub.domain.com']); 
     _gaq.push(['_trackPageview']); 

     (function() { 
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
     })(); 
    </script> 
<script type="text/javascript"> 
     var _gaq = _gaq || []; 
     _gaq.push(['_setAccount', 'UA-xxxxxx2-1']); 
     _gaq.push(['_setDomainName', 'sub.domain.com']); 
     _gaq.push(['_trackPageview']); 

     (function() { 
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
     })(); 
    </script> 

또는 내가 어떻게해야합니까 :

_gaq.push(
    ['_setAccount', 'UA-XXXXXXXX-1'], 
    ['_trackPageview'], 
    ['b._setAccount', 'UA-XXXXXXXX-2'], 
    ['b._trackPageview'] 
); 

을 모두 추적 장치가 동일한 내에있는 경우 다음 코드는 것입니다. ??

감사합니다.

+0

후자의 방법은 내가 사이트에서 사용하는 것처럼 작동하는 것으로 알려진 방법 중 하나입니다. – Sandeep

답변

2

이것은 예이며 작동합니다. 나는 같은 코드를 가지고있다.

_gaq.push(
    ['_setAccount', 'UA-XXXXX-1'], 
    ['_trackPageview'], 
    ['b._setAccount', 'UA-XXXXX-2'], 
    ['b._trackPageview'] 
);