You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/gatsby-plugin-google-gtag/README.md
+48-47
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ For more general information on gtag you can read Google's official documentatio
10
10
11
11
If you're migrating from analytics.js (gatsby-plugin-google-analytics) you can read about the subtle API differences in more depth at: https://developers.google.com/analytics/devguides/migration/ua/analyticsjs-to-gtagjs.
12
12
13
-
**Please note:** This plugin only works in production mode! To test your Global Site Tag is installed and firing events correctly run: `gatsby build && gatsby serve.`
13
+
**Please note:** This plugin only works in production mode! To test that your Global Site Tag is installed and firing events correctly run: `gatsby build && gatsby serve.`
If your visitors should be able to set an Opt-Out-Cookie (No future tracking)
83
+
you can set a link e.g. in your imprint as follows:
84
+
85
+
`<a href="javascript:gaOptout();">Deactivate Google Tracking</a>`
86
+
87
+
### `gtagConfig.optimize_id` option
88
+
89
+
If you need to use Google Optimize for A/B testing, you can add this optional Optimize container id to allow Google Optimize to load the correct test parameters for your site.
90
+
91
+
### Other `gtagConfig` options
92
+
93
+
The `gtagConfig` is passed directly to the gtag config command, so you can specify everything it supports, e.g. `gtagConfig.cookie_name`, `gtagConfig.sample_rate`. If you're migrating from the analytics.js plugin, this means that all Create Only Fields should be snake_cased.
94
+
95
+
### `pluginConfig.respectDNT` option
96
+
97
+
If you enable this optional option, Google Global Site Tag will not be loaded at all for visitors that have "Do Not Track" enabled. While using Google Global Site Tag does not necessarily constitute Tracking, you might still want to do this to cater to more privacy oriented users.
98
+
99
+
### `pluginConfig.exclude` option
100
+
101
+
If you need to exclude any path from the tracking system, you can add it (one or more) to this optional array as glob expressions.
102
+
103
+
### `pluginConfig.delayOnRouteUpdate` option
104
+
105
+
If you need to delay processing pageview events on route update (e.g. to wait for page transitions with [`gatsby-plugin-transition-link`](https://www.gatsbyjs.com/plugins/gatsby-plugin-transition-link/)), then this option adds a delay before generating the pageview event.
106
+
62
107
## Custom Events
63
108
64
109
This plugin automatically sends a "pageview" event to all products given as "trackingIds" on every Gatsbys route change.
@@ -99,47 +144,3 @@ export default () => (
99
144
</div>
100
145
)
101
146
```
102
-
103
-
## The "gtagConfig.anonymize_ip" option
104
-
105
-
Some countries (such as Germany) require you to use the
106
-
[\_anonymizeIP](https://support.google.com/analytics/answer/2763052) function for
107
-
Google Site Tag. Otherwise you are not allowed to use it. The option adds the
108
-
block of code below:
109
-
110
-
```js
111
-
functiongaOptout() {
112
-
;(document.cookie=
113
-
disableStr +"=true; expires=Thu, 31 Dec 2099 23:59:59 UTC;path=/"),
If your visitors should be able to set an Opt-Out-Cookie (No future tracking)
123
-
you can set a link e.g. in your imprint as follows:
124
-
125
-
`<a href="javascript:gaOptout();">Deactivate Google Tracking</a>`
126
-
127
-
## The "gtagConfig.optimize_id" option
128
-
129
-
If you need to use Google Optimize for A/B testing, you can add this optional Optimize container id to allow Google Optimize to load the correct test parameters for your site.
130
-
131
-
## Other "gtagConfig" options
132
-
133
-
The `gtagConfig` is passed directly to the gtag config command, so you can specify everything it supports, e.g. `gtagConfig.cookie_name`, `gtagConfig.sample_rate`. If you're migrating from the analytics.js plugin, this means that all Create Only Fields should be snake_cased.
134
-
135
-
## The "pluginConfig.respectDNT" option
136
-
137
-
If you enable this optional option, Google Global Site Tag will not be loaded at all for visitors that have "Do Not Track" enabled. While using Google Global Site Tag does not necessarily constitute Tracking, you might still want to do this to cater to more privacy oriented users.
138
-
139
-
## The "pluginConfig.exclude" option
140
-
141
-
If you need to exclude any path from the tracking system, you can add it (one or more) to this optional array as glob expressions.
142
-
143
-
## The "pluginConfig.delayOnRouteUpdate" option
144
-
145
-
If you need to delay processing pageview events on route update (e.g. to wait for page transitions with [`gatsby-plugin-transition-link`](https://www.gatsbyjs.com/plugins/gatsby-plugin-transition-link/)), then this option adds a delay before generating the pageview event.
0 commit comments