diff --git a/website/pages/en/404.js b/website/pages/en/404.js index d75d0a99ca..96b01f2c36 100644 --- a/website/pages/en/404.js +++ b/website/pages/en/404.js @@ -1,9 +1,29 @@ const React = require("react"); +const siteConfig = require(`${process.cwd()}/siteConfig.js`); class ErrorPage extends React.Component { + getTrackingScript() { + if (!siteConfig.gaTrackingId) { + return null; + } + + return {__html:` + ga('create', "${siteConfig.gaTrackingId}"); + ga('send', { + hitType: 'event', + eventCategory: '404 Response', + eventAction: window.location.href, + eventLabel: document.referrer + });` + } + } + render() { + const trackingScript = this.getTrackingScript(); + return (
+ {trackingScript &&