메인 컨텐츠로 이동
버전: 3.0.1

📦 plugin-google-gtag

The default Global Site Tag (gtag.js) plugin. 여러분이 구글 애널리틱스, 구글 광고, 구글 마케팅 플랫폼에 이벤트 데이터를 보낼 수 있게 하는 자바스크립트 태킹 프레임워크와 API입니다. 여기에서는 구글 애널리틱스를 위한 전역 사이트 태그를 활성화하기 위해 도큐사우루트 사이트 설정을 어떻게 해야 하는지 설명합니다.

You can use Google's Tag Assistant tool to check if your gtag is set up correctly!

production only

This plugin is always inactive in development and only active in production to avoid polluting the analytics statistics.

Installation

npm install --save @docusaurus/plugin-google-gtag

If you use the preset @docusaurus/preset-classic, you don't need to install this plugin as a dependency.

You can configure this plugin through the preset options.

Configuration

설정할 수 있는 필드

옵션명타입기본값설명
trackingIDstring | string[]Requiredgtag 서비스의 추적 ID 여러 개의 ID를 사용할 수 있습니다.
anonymizeIPbooleanfalse요청을 보낼 때 IP를 익명화할지 여부

Example configuration

프리셋 옵션이나 플러그인 옵션에서 플러그인을 설정할 수 있습니다.

대부분의 도큐사우루스 사용자는 프리셋 옵션을 사용해 플러그인을 설정합니다.

프리셋을 사용하는 경우 프리셋 옵션를 통해 플러그인을 구성합니다.

docusaurus.config.js
module.exports = {
presets: [
[
'@docusaurus/preset-classic',
{
gtag: {
trackingID: 'G-999X9XX9XX',
anonymizeIP: true,
},
},
],
],
};