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 () => { -
+ ;
-} +) + +export default Component ``` ### All Fields Options