Skip to content

Per escludere il nostro traffico dalle statistiche che usiamo per il nostro sito web, possiamo racchiudere il codice di tracciamento inserito nell’header in una condizione che verifica se siamo loggati o meno. Ad esempio nel file header.php possiamo inserire questo codice

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

        gtag('config', 'G-XXXXXX');
      </script>
@endif