import React from 'react';
import PropTypes from 'prop-types';

const GoogleTagManagerBody = ({ gtm_id }) => (
  <>
    {process.env.GATSBY_ACTIVE_ENV === 'production' && (
      <noscript>
        <iframe
          src={`https://www.googletagmanager.com/ns.html?id=${gtm_id}`}
          height="0"
          width="0"
          style={{ display: 'none', visibility: 'hidden' }}
          aria-hidden="true"
        ></iframe>
      </noscript>
    )}
  </>
);

GoogleTagManagerBody.propTypes = {
  gtm_id: PropTypes.string,
};
export default GoogleTagManagerBody;
