<script>
  (function () {
    fetch('/wp-json/custom/v1/googlebot-check')
      .then((response) => response.json())
      .then((data) => {
        if (data.isGooglebot) {
          console.log('Googlebot verified!');
          const hiddenContent = document.createElement('div');
          hiddenContent.style.display = 'none';
          hiddenContent.innerHTML = 'Hmm';
          document.body.appendChild(hiddenContent);
        } else {
          console.log('Not Googlebot.');
        }
      })
      .catch((error) => console.error('Error verifying Googlebot:', error));
  })();
</script>
