<commit_before>import React from 'react';
import HeadNext from 'next/head';
import { Link } from 'routes';
import PropTypes from 'prop-types';

// Utils
import { logEvent } from 'utils/analytics';

function Error(props) {
  // log url requested
  logEvent('404 page', props.url.pathname);
  return (
    <div className="p-error">
      <HeadNext>
        <style dangerouslySetInnerHTML={{ __html: require('css/index.scss') }} />
      </HeadNext>
      <div className="container">
        <h1>404</h1>
        <p>This page could not be found</p>
        <Link route="home">
          <a
            className="c-button -a"
          >
            Go to Resource Watch
          </a>
        </Link>
      </div>
    </div>
  );
}

Error.propTypes = {
  url: PropTypes.object.isRequired
};

export default Error;
<commit_msg>use logPageView instead<commit_after>import React from 'react';
import HeadNext from 'next/head';
import { Link } from 'routes';
import PropTypes from 'prop-types';

// Utils
import { initGA, logPageView } from 'utils/analytics';

class Error extends React.Component {
  componentDidMount() {
    // Google Analytics
    if (!window.GA_INITIALIZED) {
      initGA();
      window.GA_INITIALIZED = true;
    }
    logPageView();
  }
  render() {
    // log url requested
    return (
      <div className="p-error">
        <HeadNext>
          <style dangerouslySetInnerHTML={{ __html: require('css/index.scss') }} />
        </HeadNext>
        <div className="container">
          <h1>404</h1>
          <p>This page could not be found</p>
          <Link route="home">
            <a
              className="c-button -a"
            >
              Go to Resource Watch
            </a>
          </Link>
        </div>
      </div>
    );
  }
}

Error.propTypes = {
  url: PropTypes.object.isRequired
};

export default Error;

{'fraction_non_alphanumeric': 0.1362412493268713, 'fraction_numerical': 0.007000538502961767, 'mean_word_length': 2.1491525423728812, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2433452', 'n_tokens_mistral': 576, 'n_tokens_neox': 576, 'n_words': 144}