๋ณธ๋ฌธ์œผ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ
๋ฒ„์ „: 2.4.3

๐Ÿ“ฆ 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.

์—ฌ๋Ÿฌ๋ถ„์€ ํ”„๋ฆฌ์…‹ ์˜ต์…˜์„ ์‚ฌ์šฉํ•ด ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Configurationโ€‹

์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ํ•„๋“œ

์˜ต์…˜๋ช…ํƒ€์ž…๊ธฐ๋ณธ๊ฐ’์„ค๋ช…
trackingIDstring | string[]Requiredgtag ์„œ๋น„์Šค์˜ ์ถ”์  ID ์—ฌ๋Ÿฌ ๊ฐœ์˜ ID๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
anonymizeIPbooleanfalse์š”์ฒญ์„ ๋ณด๋‚ผ ๋•Œ IP๋ฅผ ์ต๋ช…ํ™”ํ• ์ง€ ์—ฌ๋ถ€

Example configurationโ€‹

ํ”„๋ฆฌ์…‹ ์˜ต์…˜์ด๋‚˜ ํ”Œ๋Ÿฌ๊ทธ์ธ ์˜ต์…˜์—์„œ ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํŒ

๋Œ€๋ถ€๋ถ„์˜ ๋„ํ์‚ฌ์šฐ๋ฃจ์Šค ์‚ฌ์šฉ์ž๋Š” ํ”„๋ฆฌ์…‹ ์˜ต์…˜์„ ์‚ฌ์šฉํ•ด ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

If you use a preset, configure this plugin through the preset options:

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