---
title: "Escludere il nostro traffico sul sito web dalle statistiche"
id: "572"
type: "shorts"
slug: "escludere-il-nostro-traffico-sul-sito-web-dalle-statistiche"
published_at: "2026-09-16T08:00:58+00:00"
modified_at: "2026-09-16T08:01:16+00:00"
url: "https://pierluigipapeschi.com/shorts/escludere-il-nostro-traffico-sul-sito-web-dalle-statistiche/"
markdown_url: "https://pierluigipapeschi.com/shorts/escludere-il-nostro-traffico-sul-sito-web-dalle-statistiche.md"
excerpt: "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..."
taxonomy_short_cat:
  - "Analytics"
  - "Wordpress"
---

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
```
