미디어위키:Common.js: 두 판 사이의 차이

편집 요약 없음
편집 요약 없음
340번째 줄: 340번째 줄:
var pathLang = (location.pathname.split('/')[1] || '').toLowerCase();  
var pathLang = (location.pathname.split('/')[1] || '').toLowerCase();  
var lang = (mw.config && mw.config.get('wgContentLanguage'))  
var lang = (mw.config && mw.config.get('wgContentLanguage'))  
        || (['en','es','ko'].includes(pathLang) ? pathLang : 'ko');
        || (['en','es','ko','vi','pt','ne'].includes(pathLang) ? pathLang : 'ko');
// <head>에 gtag 로더 삽입
// <head>에 gtag 로더 삽입
var s = document.createElement('script');
var s = document.createElement('script');
352번째 줄: 352번째 줄:
gtag('js', new Date());
gtag('js', new Date());
    // 🔹 자동 page_view 끄기
    gtag('config', GA_ID, {
        send_page_view: false
    });
// page_view 설정: 언어 서브디렉터리 포함 경로를 명시
// page_view 설정: 언어 서브디렉터리 포함 경로를 명시
/*
gtag('config', GA_ID, {
gtag('config', GA_ID, {
page_path: location.pathname + location.search
page_path: location.pathname + location.search
});
});
*/


// 언어를 사용자 속성으로 항상 전송(보고서에서 맞춤차원으로 필터)
// 언어를 사용자 속성으로 항상 전송(보고서에서 맞춤차원으로 필터)
gtag('set', 'user_properties', { site_language: lang });
gtag('set', 'user_properties', { site_language: lang });
// 그룹도 언어로 고정
    // page_path + content_group 같이 전송
gtag('event', 'page_view', { content_group: lang });
    gtag('event', 'page_view', {
        page_path: location.pathname + location.search,
        content_group: lang
    });
})();
})();