Closed btahir closed 3 years ago
Hi @btahir I have been facing same problem due to upgrade of google analytics. Found the solution for it. If you have existing deprecated analytics you need to update it from property column in GA console page.(I don't know exact process till end). If you are including to new project, check below steps.
@rajatrao777 That worked! Thanks :)
Hi @rajatrao777 , i've seen your solution but don't understand it, can u help me a little?
what you mean add G measurement id to plugin? There's no options to put G measurement id in gatsby-plugin-gtag document. did you mean add a G measurement id on trackingId field?
oh i've solve the problem. nvm, thx!
Hey Guys,
I'm currently using the gatsby-plugin-gtag
Plugin as recommended above. Tracking works perfectly, thanks for that so far!
But I'm wondering how can I decline the tracking?
My current setup is:
gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-gtag`,
options: {
trackingId: "G-TRACKING ID",
head: true,
anonymize: true
},
},
{
resolve: `gatsby-plugin-gdpr-cookies`,
options: {
googleAnalytics: {
trackingId: "G-TRACKING ID",
cookieName: "gatsby-gdpr-google-analytics",
anonymize: true,
},
},
environments: ["development", "production"],
},
...
]
}
In src/pages/index.js
import React from "react"
import CookieConsent from "react-cookie-consent"
export default function Home() {
return (
<div>
<CookieConsent
overlay
location="bottom"
buttonText="Accept"
enableDeclineButton
declineButtonText="Decline"
cookieName="gatsby-gdpr-google-analytics"
>
We are using cookies to enhance this site ...
</CookieConsent>
...
</div>
)
}
I know that the gatsby-plugin-gdpr-cookies
is recommended to use in combination with the deprecated gatsby-plugin-google-analytics
but is there an updated way to handle the optout?
Thanks a lot in advance!
Hi - Google Analytics just characteristically rolled out a breaking change without notice. Now instead of tracking Id we have Measurement Id (because we need it so much). It seems this breaks the Gatsby plugin. Can we get an update where the new measurement id can either swap for the tracking id or have a new parameter for Measurement Id?
Thanks!