setting Google analytics v4 terbaru di amp dan di non amp

Bismillaahirrohmaanirrohiim…

Berikut ini kode Google analytics / GA versi 4 untuk Website non AMP:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-xxxxx"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-xxxxx');
</script>

Berikut ini kode Google Analytics V4 untuk website AMP:

<amp-analytics  type="googleanalytics"  config="https://amp.analytics-debugger.com/ga4.json"  data-credentials="include">
    <script  type="application/json">
    {
      "vars": {
        "GA4_MEASUREMENT_ID": "G-xxxxxx",
        "GA4_ENDPOINT_HOSTNAME": "www.google-analytics.com",
        "GOOGLE_CONSENT_ENABLED": false,
        "WEBVITALS_TRACKING": false,
        "PERFORMANCE_TIMING_TRACKING": false,
        "DEFAULT_PAGEVIEW_ENABLED": true,
        "SEND_DOUBLECLICK_BEACON": false,
        "DISABLE_REGIONAL_DATA_COLLECTION": false,
        "ENHANCED_MEASUREMENT_SCROLL": false
      }
    }
    </script>
</amp-analytics>

Terimakasih…

Bagikan
Baca Juga:   Membuat pagination menjadi responsive pada bootstrap 4

You May Also Like

About the Author: rasupe

Leave a Reply

Your email address will not be published. Required fields are marked *