π¦ 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.
Installation
Section titled βInstallationβnpm install --save @docusaurus/plugin-google-gtagConfiguration
Section titled βConfigurationβAccepted fields:
<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. |
</APITable>Example configuration
Section titled βExample configurationβYou can configure this plugin through preset options or plugin options.
// Preset Options: gtag
// Plugin Options: @docusaurus/plugin-google-gtag
const config = {
trackingID: 'G-999X9XX9XX',
anonymizeIP: true,
};