title: React (Gatsby) deactivate Google Analytics in TypeScript
body: <p>How to create a deactive Goole Analytics link in Gatsby.JS? My link doesn't deactivate Google Analytics.</p>
  
  <p>Used plugins:
  <a href="https://www.gatsbyjs.org/packages/gatsby-plugin-gdpr-cookies/" rel="nofollow noreferrer">https://www.gatsbyjs.org/packages/gatsby-plugin-gdpr-cookies/</a>
  <a href="https://www.gatsbyjs.org/packages/gatsby-plugin-gdpr-tracking/?=gd" rel="nofollow noreferrer">https://www.gatsbyjs.org/packages/gatsby-plugin-gdpr-tracking/?=gd</a></p>
  
  <p>I have a link that should deactivate Google Analytics:</p>
  
  <pre><code>  &lt;Link
        href="javascript:gaOptout();"
        data-ua={process.env.GATSBY_GOOGLE_ANALYTICS_TRACKING_ID}
      &gt;
        Deactivate Google Analytics
      &lt;/Link&gt;
  </code></pre>
  
  <p>But I always get the following error message:
  Uncaught ReferenceError: gaOptout is not defined at :1:1</p>