From 0f9314d7802ac83f07bf0dfd0141cd5b065bb7f6 Mon Sep 17 00:00:00 2001
From: Muescha <184316+muescha@users.noreply.github.com>
Date: Thu, 7 Jan 2021 19:11:33 +0100
Subject: [PATCH 1/5] chore(docs): google plugin analytics - info about upgrade
to gtag, fix code sample
---
packages/gatsby-plugin-google-analytics/README.md | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/packages/gatsby-plugin-google-analytics/README.md b/packages/gatsby-plugin-google-analytics/README.md
index fb2f832e66ed6..86a4d5542d006 100644
--- a/packages/gatsby-plugin-google-analytics/README.md
+++ b/packages/gatsby-plugin-google-analytics/README.md
@@ -2,6 +2,10 @@
Easily add Google Analytics to your Gatsby site.
+## Upgrade note
+
+This plugin uses under the hood the Google's `analytics.js` file. Google has a [guide recommending users upgrade to `gtag.js` instead](https://developers.google.com/analytics/devguides/collection/upgrade/analyticsjs). There is another plugin [`gatsby-plugin-gtag`](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-google-gtag) which uses `gtag.js`.
+
## Install
`npm install gatsby-plugin-google-analytics`
@@ -164,11 +168,11 @@ To allow custom events to be tracked, the plugin exposes a function to include i
To use it, import the package and call the event within your components and business logic.
```jsx
-import React
-import { trackCustomEvent } from 'gatsby-plugin-google-analytics'
+import React from "react"
+import { trackCustomEvent } from "gatsby-plugin-google-analytics"
export default () => {
-
+ ;
{
// To stop the page reloading
@@ -182,7 +186,7 @@ export default () => {
// string - optional - Useful for categorizing events (e.g. 'Spring Campaign')
label: "Gatsby Plugin Example Campaign",
// number - optional - Numeric value associated with the event. (e.g. A product ID)
- value: 43
+ value: 43,
})
//... Other logic here
}}
From 797e15ee351dd0fc451031a87a8c8753885a5fdd Mon Sep 17 00:00:00 2001
From: Muescha <184316+muescha@users.noreply.github.com>
Date: Thu, 7 Jan 2021 19:18:27 +0100
Subject: [PATCH 2/5] chore(docs): google plugin analytics - remove unexpected
changes
---
packages/gatsby-plugin-google-analytics/README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/gatsby-plugin-google-analytics/README.md b/packages/gatsby-plugin-google-analytics/README.md
index 86a4d5542d006..886f9db00a59e 100644
--- a/packages/gatsby-plugin-google-analytics/README.md
+++ b/packages/gatsby-plugin-google-analytics/README.md
@@ -172,7 +172,7 @@ import React from "react"
import { trackCustomEvent } from "gatsby-plugin-google-analytics"
export default () => {
- ;
+
{
// To stop the page reloading
@@ -186,7 +186,7 @@ export default () => {
// string - optional - Useful for categorizing events (e.g. 'Spring Campaign')
label: "Gatsby Plugin Example Campaign",
// number - optional - Numeric value associated with the event. (e.g. A product ID)
- value: 43,
+ value: 43
})
//... Other logic here
}}
From d97c95240d1336ae612b2c7f3ab4debb9ad6e587 Mon Sep 17 00:00:00 2001
From: Muescha <184316+muescha@users.noreply.github.com>
Date: Thu, 7 Jan 2021 19:20:27 +0100
Subject: [PATCH 3/5] chore(docs): google plugin analytics - remove unexpected
changes
---
packages/gatsby-plugin-google-analytics/README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/gatsby-plugin-google-analytics/README.md b/packages/gatsby-plugin-google-analytics/README.md
index 886f9db00a59e..86a4d5542d006 100644
--- a/packages/gatsby-plugin-google-analytics/README.md
+++ b/packages/gatsby-plugin-google-analytics/README.md
@@ -172,7 +172,7 @@ import React from "react"
import { trackCustomEvent } from "gatsby-plugin-google-analytics"
export default () => {
-
+ ;
{
// To stop the page reloading
@@ -186,7 +186,7 @@ export default () => {
// string - optional - Useful for categorizing events (e.g. 'Spring Campaign')
label: "Gatsby Plugin Example Campaign",
// number - optional - Numeric value associated with the event. (e.g. A product ID)
- value: 43
+ value: 43,
})
//... Other logic here
}}
From 02d10b7b0693502cdcd42b45913ed667fb29c689 Mon Sep 17 00:00:00 2001
From: Muescha <184316+muescha@users.noreply.github.com>
Date: Thu, 7 Jan 2021 19:24:13 +0100
Subject: [PATCH 4/5] chore(docs): google plugin analytics - remove unexpected
changes
---
packages/gatsby-plugin-google-analytics/README.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/packages/gatsby-plugin-google-analytics/README.md b/packages/gatsby-plugin-google-analytics/README.md
index 86a4d5542d006..c6cf33fd42395 100644
--- a/packages/gatsby-plugin-google-analytics/README.md
+++ b/packages/gatsby-plugin-google-analytics/README.md
@@ -168,11 +168,11 @@ To allow custom events to be tracked, the plugin exposes a function to include i
To use it, import the package and call the event within your components and business logic.
```jsx
-import React from "react"
-import { trackCustomEvent } from "gatsby-plugin-google-analytics"
+import React from 'react'
+import { trackCustomEvent } from 'gatsby-plugin-google-analytics'
export default () => {
- ;
+
{
// To stop the page reloading
@@ -186,7 +186,7 @@ export default () => {
// string - optional - Useful for categorizing events (e.g. 'Spring Campaign')
label: "Gatsby Plugin Example Campaign",
// number - optional - Numeric value associated with the event. (e.g. A product ID)
- value: 43,
+ value: 43
})
//... Other logic here
}}
From 407891b89ec370e6a8efbb9edf4bdad5f465e197 Mon Sep 17 00:00:00 2001
From: LekoArts
Date: Fri, 8 Jan 2021 09:38:22 +0100
Subject: [PATCH 5/5] fix invalid component
---
.../gatsby-plugin-google-analytics/README.md | 20 +++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/packages/gatsby-plugin-google-analytics/README.md b/packages/gatsby-plugin-google-analytics/README.md
index c6cf33fd42395..6c2d36ea8ea45 100644
--- a/packages/gatsby-plugin-google-analytics/README.md
+++ b/packages/gatsby-plugin-google-analytics/README.md
@@ -4,7 +4,7 @@ Easily add Google Analytics to your Gatsby site.
## Upgrade note
-This plugin uses under the hood the Google's `analytics.js` file. Google has a [guide recommending users upgrade to `gtag.js` instead](https://developers.google.com/analytics/devguides/collection/upgrade/analyticsjs). There is another plugin [`gatsby-plugin-gtag`](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-google-gtag) which uses `gtag.js`.
+This plugin uses Google's `analytics.js` file under the hood. Google has a [guide recommending users upgrade to `gtag.js` instead](https://developers.google.com/analytics/devguides/collection/upgrade/analyticsjs). There is another plugin [`gatsby-plugin-gtag`](https://gatsbyjs.com/plugins/gatsby-plugin-google-gtag/) which uses `gtag.js`.
## Install
@@ -64,13 +64,15 @@ To use it, simply import it and use it like you would the `` element e.g.
import React from "react"
import { OutboundLink } from "gatsby-plugin-google-analytics"
-export default () => (
+const Component = () => (
-
+
Visit the Google Analytics plugin page!
)
+
+export default Component
```
## Options
@@ -168,10 +170,10 @@ To allow custom events to be tracked, the plugin exposes a function to include i
To use it, import the package and call the event within your components and business logic.
```jsx
-import React from 'react'
-import { trackCustomEvent } from 'gatsby-plugin-google-analytics'
+import React from "react"
+import { trackCustomEvent } from "gatsby-plugin-google-analytics"
-export default () => {
+const Component = () => (
{
@@ -186,7 +188,7 @@ export default () => {
// string - optional - Useful for categorizing events (e.g. 'Spring Campaign')
label: "Gatsby Plugin Example Campaign",
// number - optional - Numeric value associated with the event. (e.g. A product ID)
- value: 43
+ value: 43,
})
//... Other logic here
}}
@@ -194,7 +196,9 @@ export default () => {
Tap that!
-}
+)
+
+export default Component
```
### All Fields Options