Skip to main content
Docusaurus

Search documentation

Type to search this documentation.

On this pageOverview

πŸ“¦ plugin-google-gtag

The default Global Site Tag (gtag.js) plugin. It is a JavaScript tagging framework and API that allows you to send event data to Google Analytics, Google Ads, and Google Marketing Platform. This section describes how to configure a Docusaurus site to enable global site tag for Google Analytics.

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

Accepted fields:

mdx-code-block
<APITable>
Name Type Default Description
trackingID string | string[] Required The tracking ID of your gtag service. It is possible to provide multiple ids.
anonymizeIP boolean false Whether the IP should be anonymized when sending requests.
mdx-code-block
</APITable>

You can configure this plugin through preset options or plugin options.

config-tabs
// Preset Options: gtag
// Plugin Options: @docusaurus/plugin-google-gtag

const config = {
  trackingID: 'G-999X9XX9XX',
  anonymizeIP: true,
};
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu