An Rsbuild plugin to setup Google Analytics in your website.
npm install rsbuild-plugin-google-analyticsAn Rsbuild plugin to setup Google Analytics in your website.
Install:
``bash`
npm add rsbuild-plugin-google-analytics -D
Add plugin to your rsbuild.config.ts:
`ts
// rsbuild.config.ts
import { pluginGoogleAnalytics } from 'rsbuild-plugin-google-analytics';
export default {
plugins: [
pluginGoogleAnalytics({
// replace this with your Google tag ID
// see: https://support.google.com/analytics/answer/9539598?hl=en
id: 'G-xxxxxxxxxx',
}),
],
};
`
Here are the available options:
| Name | Type | Description | Defaults |
| ------ | --------- | ---------------------------------- | ----------- |
| id | string | Google tag ID | undefined |boolean
| enable | | Whether to enable Google Analytics | true` |
MIT.