미디어위키에서 구글 애널릭틱스 연동하기

GameDic
이동: 둘러보기, 검색

다운로드

아래 사이트를 통해서 압축되어있는 파일을 받습니다.

https://www.mediawiki.org/wiki/Special:ExtensionDistributor?extdist_name=googleAnalytics&extdist_version=REL1_26&extdist_submit=

설치

설치 파일을 mediawiki의 extensions 폴더에 복사합니다.

tar -xzf googleAnalytics-REL1_26-d832801.tar.gz -C /var/www/mediawiki/extensions

다음 코드를 LocalSettings.php에 추가합니다.

require_once "$IP/extensions/googleAnalytics/googleAnalytics.php";
// Replace xxxxxxx-x with YOUR GoogleAnalytics UA number
$wgGoogleAnalyticsAccount = 'UA-xxxxxxx-x'; 
// Add HTML code for any additional web analytics (can be used alone or with $wgGoogleAnalyticsAccount)
$wgGoogleAnalyticsOtherCode = '<script type="text/javascript" src="https://analytics.example.com/tracking.js"></script>';
 
// Optional configuration (for defaults see googleAnalytics.php)
// Store full IP address in Google Universal Analytics (see https://support.google.com/analytics/answer/2763052?hl=en for details)
$wgGoogleAnalyticsAnonymizeIP = false; 
// Array with NUMERIC namespace IDs where web analytics code should NOT be included.
$wgGoogleAnalyticsIgnoreNsIDs = array(500);
// Array with page names (see magic word Extension:Google Analytics Integration) where web analytics code should NOT be included.
$wgGoogleAnalyticsIgnorePages = array('ArticleX', 'Foo:Bar');
// Array with special pages where web analytics code should NOT be included.
$wgGoogleAnalyticsIgnoreSpecials = array( 'Userlogin', 'Userlogout', 'Preferences', 'ChangePassword', 'OATH');
// Use 'noanalytics' permission to exclude specific user groups from web analytics, e.g.
$wgGroupPermissions['sysop']['noanalytics'] = true;
$wgGroupPermissions['bot']['noanalytics'] = true;
// To exclude all logged in users give 'noanalytics' permission to 'user' group, i.e.
$wgGroupPermissions['user']['noanalytics'] = true;


트러블슈팅

위방법으로 셋팅을하고 세션테스트를 진행을 하니, 되지 않았다. 임시적으로, $wgGroupPermissions['sysop']['noanalytics'] = true;, $wgGroupPermissions['bot']['noanalytics'] = true;, $wgGroupPermissions['user']['noanalytics'] = true; 이 부분을 주석처리를 한후에 정상적으로 세션이 잡히는 것이 확인되었다.

## $wgGroupPermissions['sysop']['noanalytics'] = true;
## $wgGroupPermissions['bot']['noanalytics'] = true;
// To exclude all logged in users give 'noanalytics' permission to 'user' group, i.e.
## $wgGroupPermissions['user']['noanalytics'] = true;


참고

https://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration

http://www.google.co.kr/intl/ko/analytics/