2012-09-25 5 views
-1

드루팔 6의 htaccess로 말한다 :Google 애널리틱스에 drupal 검색 매개 변수가 포함되어 있습니까?

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !=/favicon.ico 
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 

을 그래서, 당신은 검색하면, 당신과 같이 경로를 입력 할 수 있습니다

mysite.com/search/SEARCH_STRING 

을 내가 Google 웹 로그 분석이 사용자는 "검색 것을 추적 할 수 있도록하려면 SEARCH_STRING "입니다. 어떻게해야합니까?

답변

1

Google Analytics은 검색 쿼리 추적을 지원합니다. 템플릿 파일의 GA 코드를 포함하고 GA 모듈로 돌아갈 수없는 경우

, 당신은 검색 쿼리를 추출하고 같은과 자바 스크립트에서 추적 URL에 추가 할 수 있습니다 :

var search_matches = window.location.pathname.match(/\/search\/(.*?)\/(.*)/); 
if (search_matches) { 
    _gaq.push(['_trackPageview', window.location.pathname + [window.location.search, (window.location.search ? '&' : '?'), 'search=', search_matches[2] , '&search_type=', search_matches[1]].join('')]); 
} 
else { 
    _gaq.push(['_trackPageview']); 
} 
관련 문제