Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Coppa WPB
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Come installare Google Analytics in WordPress per i principianti

Capire come i visitatori interagiscono con i vostri contenuti è fondamentale per raggiungere i vostri obiettivi come proprietari di un sito web. Se il vostro obiettivo è far crescere un pubblico di lettori fedeli, aumentare le vendite o affermarvi come autorità nella vostra nicchia, avere accesso ai dati sul traffico del sito web è molto importante.

È qui che entra in gioco Google Analytics. Si tratta di uno strumento gratuito e potente di Google che fornisce informazioni sul comportamento del pubblico. Ciò consente di prendere decisioni basate sui dati per migliorare la strategia del sito web e dei contenuti.

In oltre 16 anni di esperienza, crediamo che Google Analytics sia rimasto il modo migliore per conoscere il vostro pubblico. Abbiamo anche aiutato molti utenti a installare e iniziare a utilizzare Google Analytics sui loro siti WordPress.

In questo articolo condivideremo perché Google Analytics è importante e come potete installare facilmente Google Analytics in WordPress (passo dopo passo).

How to Install Google Analytics in WordPress

Innanzitutto, spiegheremo perché Google Analytics è importante e come può aiutarvi a far crescere il vostro sito web.

In seguito, vi mostreremo come registrare un account Google Analytics e diversi metodi per installarlo sul vostro sito WordPress.

Infine, vi spiegheremo come visualizzare i rapporti sul traffico in Google Analytics.

Ecco una rapida panoramica di ciò che imparerete in questo articolo:

Pronti? Iniziamo!

Perché Google Analytics è importante per i blogger?

Una volta aperto un blog, l’obiettivo numero uno è quello di ottenere più traffico e abbonati. Google Analytics vi aiuta a prendere decisioni basate sui dati, mostrandovi le statistiche che contano. Potete vedere:

Chi visita il vostro sito web?

Questa parte dell’analisi mostra la posizione geografica del pubblico, il browser utilizzato dall’utente per visitare il sito e altre informazioni importanti come la risoluzione dello schermo, il supporto di JavaScript, il supporto di Flash, la lingua e altro ancora.

Questi dati sono estremamente utili e possono aiutare in molti modi. Quando si crea un sito web personalizzato, è possibile utilizzare i dati degli utenti per assicurarsi che il sito sia compatibile con il pubblico.

Se la maggior parte dei vostri utenti non supporta Flash, dovreste evitare di aggiungere l’elemento Flash al vostro sito. Se la maggior parte dei vostri utenti ha una risoluzione dello schermo di 1280, assicuratevi che il vostro progetto sia compatibile con quella risoluzione o con una più piccola.

Cosa fanno le persone quando sono sul vostro sito web?

È possibile monitorare dove gli utenti si recano sul vostro sito web, quanto tempo rimangono sul vostro sito e la frequenza di rimbalzo (la percentuale di utenti che escono dal vostro sito alla prima visita).

L’utilizzo di queste informazioni può ridurre la frequenza di rimbalzo e aumentare le visualizzazioni delle pagine.

Potete anche trovare gli articoli più popolari, quelli che non stanno andando bene e il tipo di contenuti che i vostri utenti stanno cercando.

Quando le persone visitano il vostro sito web?

Osservando le ore più calde della giornata per il vostro sito, potete scegliere il momento migliore per pubblicare il vostro post. Se il fuso orario non è compatibile con il vostro, potete programmare il post per quell’ora.

Come le persone trovano il vostro sito web?

Questa sezione dell’analisi mostra la provenienza degli utenti. Ad esempio, utilizzano i motori di ricerca, inseriscono link diretti o cliccano su link di riferimento da un altro sito?

Mostra anche la percentuale di visitatori provenienti da ciascuna di queste fonti. Google Analytics fornisce una ripartizione di ciascuna di queste categorie. Se si tratta della categoria dei motori di ricerca, mostra quale motore di ricerca ha generato il maggior traffico, come Google, Yahoo, Bing e così via.

La ripartizione delle fonti di riferimento mostra quali sono i siti con cui dovete lavorare di più. Se la vostra fonte di riferimento principale è Facebook, avete bisogno di contenuti esclusivi per Facebook per far sentire il vostro pubblico speciale.

Se la vostra fonte di riferimento principale è un sito web esterno, allora potreste prendere in considerazione la possibilità di avere una partnership con quel sito( scambio diguest post o altro).

Come interagiscono le persone con i vostri contenuti?

Google Analytics mostra come gli utenti interagiscono con i contenuti del sito. Vi mostra la percentuale di utenti che hanno cliccato su un determinato link del vostro sito e molto altro ancora.

È possibile eseguire split test A/B creando esperimenti sui contenuti in Google Analytics per capire cosa funziona meglio per raggiungere i propri obiettivi.

Vedendo l’interattività degli utenti, è possibile lavorare sui contenuti in base agli utenti. Le risposte alle domande di cui sopra consentono di concentrarsi sulle strategie che funzionano per il proprio sito e di evitare i metodi che non funzionano.

In poche parole, eliminate le congetture e concentratevi sulle statistiche che contano, in modo da poter prendere decisioni basate sui dati.

Video tutorial

Subscribe to WPBeginner

Se preferite le istruzioni scritte, continuate a leggere.

Come iscriversi a Google Analytics

Google Analytics è disponibile gratuitamente e tutto ciò che serve è un account Google o Gmail per iscriversi. Il processo di registrazione è abbastanza semplice. Seguite le istruzioni passo passo riportate di seguito per creare il vostro account Google Analytics.

Fase 1: Per prima cosa, è necessario visitare il sito web di Google Analytics per iscriversi. Una volta sul sito, è sufficiente fare clic sul pulsante “Inizia oggi”.

Click get started today

Successivamente, vi verrà chiesto di accedere con il vostro account Google.

Se si dispone già di un account Google o Gmail, è possibile utilizzarlo per accedere. Altrimenti, potete creare un account Google.

Sign in using your Google account

Fase 2: una volta effettuato l’accesso con il proprio account Gmail, verrà visualizzata una schermata di benvenuto come quella riportata di seguito.

Qui si effettua la registrazione a Google Analytics con il proprio account Gmail. Fare clic sul pulsante “Inizia a misurare”.

Click start measuring button

Successivamente, vi verrà chiesto di fornire il nome dell’account.

Questo nome verrà utilizzato internamente, quindi è possibile utilizzare qualsiasi cosa, come il nome della propria azienda.

Enter your Google account name

Google Analytics mostrerà anche le impostazioni di condivisione dei dati di più account.

Queste impostazioni consentono di controllare la condivisione dei dati di Google Analytics. È possibile mantenere le impostazioni predefinite e passare alla fase successiva.

Account data sharing settings

Fase 3: nella schermata successiva, è necessario creare una proprietà di Google Analytics.

Google ha introdotto una nuova versione di Analytics chiamata Google Analytics 4 o GA4. Si tratta dell’ultima versione che tiene traccia del vostro sito web e delle applicazioni mobili nello stesso account. Inoltre, offre nuove funzionalità, metriche e un’interfaccia diversa per i rapporti.

Inserire il nome della proprietà e selezionare il fuso orario e la valuta di riferimento. Quindi fare clic sul pulsante “Avanti”.

Enter property name

Nella schermata successiva, dovrete selezionare una “Categoria di settore” dal menu a tendina per il vostro sito web e scegliere una “Dimensione aziendale” tra le opzioni disponibili.

Al termine, fare clic sul pulsante “Avanti”.

Enter business details

Successivamente, dovrete scegliere gli obiettivi aziendali e selezionare il modo in cui intendete utilizzare Google Analytics con la vostra azienda. Questo vi aiuterà a ottenere rapporti personalizzati per la vostra attività.

Per esempio, ci sono opzioni come la generazione di lead, la guida alle vendite online, la sensibilizzazione del marchio, l’esame del comportamento degli utenti e altro ancora.

È possibile scegliere più opzioni o tutte le opzioni indicate che soddisfano le proprie esigenze. Si consiglia di selezionare l’opzione “Ottieni rapporti di base” per ottenere tutti i rapporti di Google Analytics popolati nel proprio account.

Choose your business objectives

Una volta terminato, è sufficiente fare clic sul pulsante “Crea”.

Fase 4: ora vengono presentate le opzioni del flusso Web di Google Analytics.

Poiché stiamo configurando Google Analytics per un sito WordPress, selezionare “Web” come piattaforma.

Select data collection option

Successivamente, dovrete inserire l’URL del vostro sito web e il nome dello Stream.

Per impostazione predefinita, in Google Analytics è attiva l’opzione “Misurazione avanzata”. Ciò consente di monitorare le pagine viste, gli scorrimenti, i clic in uscita, i download di file e altro ancora in Google Analytics.

Nota: se si intende utilizzare il plugin MonsterInsights, è necessario disattivare l’opzione “Misurazione avanzata”. In caso contrario, il plugin raccoglierà e visualizzerà una quantità doppia di dati.

Successivamente, è possibile fare clic sul pulsante “Crea flusso”.

Enter website URL and stream name

Ora è possibile vedere il nome del flusso, l’URL, l’ID e l’ID di misurazione.

Mostra anche le diverse misurazioni potenziate che verranno registrate.

View stream ID and measurement ID

In alto, vedrete anche una barra di avviso che vi mostrerà come aggiungere Google Analytics al vostro sito WordPress.

Fate clic sul pulsante “Visualizza istruzioni per il tag”. Ora dovreste vedere diversi modi per aggiungere il codice di monitoraggio di Google Analytics al vostro sito web WordPress.

View Analytics installation instructions

Successivamente, si può passare alla scheda “Installa manualmente”.

Verrà quindi visualizzato il codice di monitoraggio di Google Analytics.

Install GA code manually

Copiate questo codice di tracciamento perché dovrete inserirlo nel vostro sito WordPress a seconda del metodo utilizzato. Potete anche lasciare semplicemente aperta questa scheda del browser e tornare a copiare il codice quando necessario.

Si consiglia di lasciare aperta la scheda del browser di Analytics, poiché potrebbe essere necessario rivederla una volta installato il codice sul sito WordPress.

Ora che avete configurato un account Google Analytics, vediamo come installare Google Analytics in WordPress.

Come installare Google Analytics in WordPress

Esistono diversi modi per impostare Google Analytics in WordPress. Vi mostreremo tre metodi, di cui il primo è il più semplice e l’ultimo il più difficile.

Potete scegliere quello più adatto alle vostre esigenze.

Nota: è necessario utilizzare solo uno di questi metodi sul proprio sito web per evitare il doppio tracciamento delle pagine viste nel proprio account Google Analytics.

Metodo 1: Google Analytics per WordPress di MonsterInsights

MonsterInsights è il più popolare plugin di Google Analytics per WordPress. Oltre 3 milioni di siti web lo utilizzano, tra cui Bloomberg, PlayStation, Zillow, WPBeginner e altri.

È il modo più semplice e di gran lunga migliore per aggiungere Google Analytics a WordPress (per tutti gli utenti, principianti ed esperti). MonsterInsights è disponibile sia come plugin premium a pagamento che in versione gratuita. In questo tutorial utilizzeremo la versione gratuita di MonsterInsights.

È possibile utilizzare la versione MonsterInsights Pro se si desiderano funzioni più avanzate come il tracciamento dell’e-commerce, il tracciamento degli annunci, il tracciamento degli autori e così via. Il processo di configurazione è lo stesso.

Per ulteriori informazioni, potete consultare la nostra recensione completa di MonsterInsights.

Cominciamo.

La prima cosa da fare è installare e attivare il plugin MonsterInsights. Per maggiori dettagli, consultate la nostra guida passo-passo su come installare un plugin di WordPress.

Dopo l’attivazione, il plugin aggiungerà una nuova voce di menu denominata “Insights” al menu di amministrazione di WordPress e verrà visualizzata una schermata di benvenuto. Fate clic sul pulsante “Avvia la procedura guidata”.

Launch setup wizard

Facendo clic su di esso si aprirà la procedura di configurazione guidata di MonsterInsights.

Per prima cosa, vi verrà chiesto di scegliere una categoria per il vostro sito web (un sito aziendale, un blog o un negozio online). Selezionatene una e fate clic sul pulsante “Salva e continua”.

Choose what describe your website

Successivamente, è necessario collegare MonsterInsights al proprio sito web WordPress.

È sufficiente fare clic sul pulsante “Connetti MonsterInsights”.

Connect MonsterInsights with your site

In questo modo si accede agli account Google, dove viene chiesto di accedere o di selezionare un account Google se si è già iscritti.

Scegliete il vostro account Google o inserite la vostra e-mail per accedere.

Choose Google account to sign in

Successivamente, vi verrà chiesto di consentire a MonsterInsights di accedere al vostro account Google Analytics.

Fare clic sul pulsante “Consenti” per continuare.

Allow access to your Google account

Il passo successivo per completare la connessione è selezionare il profilo che si desidera monitorare.

È necessario selezionare il proprio sito web e fare clic sul pulsante “Completa connessione” per continuare.

Connect analytics with your site

Dopodiché, è sufficiente fare clic sul pulsante “Completa connessione” per continuare. MonsterInsights installerà ora Google Analytics sul vostro sito web.

Successivamente, vi verrà chiesto di selezionare le impostazioni consigliate per il vostro sito web.

Recommended settings

Le impostazioni predefinite funzionano per la maggior parte dei siti web. Se si utilizza un plugin per i link di affiliazione, è necessario aggiungere il percorso utilizzato per occultare i link di affiliazione. In questo modo sarà possibile tracciare i link di affiliazione in Google Analytics.

MonsterInsights chiederà anche chi può vedere i rapporti. È possibile scegliere diversi ruoli utente di WordPress.

Una volta terminato, basta fare clic sul pulsante “Salva e continua” per salvare le impostazioni.

Who can see the reports

Successivamente, MonsterInsights vi mostrerà un elenco di funzioni di tracciamento del sito web che desiderate abilitare.

È possibile scorrere verso il basso e fare clic sul pulsante “Continua” o sull’opzione “Salta per ora”.

Choose which tracking features to enable

Nella schermata successiva, MonsterInsights mostrerà che avete impostato con successo il monitoraggio di Google Analytics.

Si può notare che Google Analytics è collegato, il codice di tracciamento è installato e i dati vengono ora raccolti.

Tracking should be all setup

Successivamente, si può scorrere verso il basso e vedere un campo per inserire la chiave di licenza.

Per ora fate clic sull’opzione “Completa l’installazione senza aggiornare”.

Continue setup without upgrading

Avete aggiunto con successo Google Analytics al vostro sito web WordPress.

Disattivare la misurazione avanzata in Google Analytics

Se si è creato un flusso di dati in GA4 da soli, invece di lasciare che MonsterInsights lo crei, è necessario disattivare la misurazione avanzata.

Questo perché MonsterInsights aggiunge diverse funzioni di tracciamento personalizzato. Se si lascia attivata l’opzione Misurazione avanzata, i dati saranno falsati e i risultati non saranno corretti.

Innanzitutto, è possibile accedere alla scheda o alla finestra di Google Analytics nel browser. Da qui, fare clic sull’opzione delle impostazioni “Admin” nell’angolo in basso a sinistra.

Switch to admin view in Google Analytics

Una volta entrati nella pagina ‘Admin’, si vedranno diverse impostazioni.

È sufficiente fare clic sull’opzione “Flussi di dati”.

Go to admin and data stream settings

Successivamente, verranno visualizzati i flussi di dati.

È sufficiente selezionare il flusso di dati collegato a MonsterInsights.

Select your data stream

Nella schermata successiva, è necessario disattivare l’opzione “Misurazione avanzata”.

Per farlo, è sufficiente fare clic sulla levetta.

Disable enhanced measurement

Successivamente, si aprirà una finestra a comparsa che confermerà l’intenzione di disattivare la misurazione avanzata.

Fare clic sul pulsante “Spegni”.

Click turn off button for enhanced measurement

Modificare le impostazioni di conservazione dei dati in Google Analytics

Per impostazione predefinita, Google Analytics imposta la conservazione dei dati a 2 mesi. Tuttavia, è possibile modificare questa impostazione in modo da poter utilizzare i dati nei rapporti personalizzati oltre i 2 mesi.

Per prima cosa, è necessario andare su Amministrazione ” Impostazioni dati ” Conservazione dei dati in Google Analytics.

Open data retention settings

Successivamente, è possibile fare clic sul menu a discesa “Conservazione dei dati degli eventi”.

Da qui, è sufficiente selezionare l’opzione “14 mesi” e fare clic sul pulsante “Salva”.

Change data retention settings

Ricordate che Google Analytics impiegherà un po’ di tempo prima di mostrare le statistiche.

Visualizzare i rapporti di Google Analytics all’interno della dashboard di WordPress

La cosa migliore di MonsterInsights è che potete visualizzare i rapporti di Google Analytics all’interno della vostra dashboard di WordPress.

È sufficiente visitare la pagina Insights ” Reports per avere una rapida panoramica dei dati analitici.

Dashboard reports

È inoltre possibile aggiungere annotazioni direttamente ai rapporti di MonsterInsights per registrare le modifiche chiave apportate al sito web.

Ad esempio, è possibile aggiungere una nota quando si pubblica un nuovo post sul blog, si aggiunge una nuova landing page e così via. In questo modo è facile monitorare l’impatto di questi eventi sul traffico.

View your site notes under the report

Per maggiori dettagli, consultate questa guida su come ottenere le annotazioni del sito GA4 in WordPress.

Inoltre, è dotato di un addon Popular Posts che consente di mostrare i contenuti più performanti per aumentare il traffico e le pagine viste.

MonsterInsights Popular Posts Widget

Si può usare per aggiungere automaticamente i link ai post più popolari per aumentare il coinvolgimento.

Se gestite un negozio online, può anche aggiungere automaticamente i vostri prodotti più performanti alla fine di ogni post del blog per incrementare le vendite:

MonsterInsights popular products

Nota: MonsterInsights era precedentemente noto come Google Analytics per WordPress by Yoast. Il fondatore di WPBeginner, Syed Balkhi, ha acquisito il plugin nel 2016 e lo ha ribattezzato MonsterInsights. Ora fa parte della nostra famiglia di plugin premium per WordPress.

Metodo 2: Installare Google Analytics in WordPress con WPCode

Questo metodo non è altrettanto valido di MonsterInsights, perché non è possibile eseguire una configurazione avanzata del tracciamento e non è possibile visualizzare i dati di Google Analytics nella dashboard di WordPress.

Per prima cosa, è necessario copiare il codice di tracciamento di Google Analytics (Global site tag) che è stato copiato al punto 4 durante la creazione di un account Google Analytics.

Install GA code manually

Successivamente, è necessario installare e attivare il plugin WPCode. Per maggiori dettagli, consultate la nostra guida passo passo su come installare un plugin di WordPress.

Dopo l’attivazione, è necessario visitare la pagina Code Snippets ” Header & Footer. Qui si deve incollare il codice di monitoraggio di Google Analytics copiato in precedenza nella sezione “Intestazione”.

Enter tracking code in header using WPCode

Non dimenticate di fare clic sul pulsante “Salva modifiche” per memorizzare le impostazioni.

È tutto, avete installato con successo Google Analytics sul vostro sito.

Metodo 3: Installare Google Analytics nel tema di WordPress

Questo metodo è riservato agli utenti esperti che hanno familiarità con il codice. È in qualche modo inaffidabile, perché il codice scompare se si cambia o si aggiorna il tema.

Non consigliamo quasi mai di utilizzare questo metodo.

Se è la prima volta che aggiungete codice ai vostri file di WordPress, date un’occhiata alla nostra guida su come copiare e incollare snippet di codice in WordPress.

Per prima cosa, è necessario copiare il codice di monitoraggio di Google Analytics copiato nella fase 4 precedente. È possibile visualizzarlo nella sezione Installazione del flusso web sotto la scheda “Installa manualmente”.

Install GA code manually

Esistono due modi comuni per aggiungere questo codice ai file del vostro tema WordPress. Potete scegliere uno dei due (non entrambi).

1. Aggiungere il codice nel file header.php

Basta modificare il file header.php del tema WordPress e incollare il codice di monitoraggio di Google Analytics copiato in precedenza subito dopo il tag <body>.

Non dimenticate di salvare le modifiche e di caricare il file sul vostro server.

2. Aggiungere tramite il file delle funzioni

È anche possibile aggiungere il codice di monitoraggio di Google Analytics al file delle funzioni di WordPress. Il codice di tracciamento verrà aggiunto automaticamente a ogni pagina del vostro sito WordPress.

È necessario aggiungere questo codice al file functions.php del tema.

<?php
add_action('wp_head', 'wpb_add_googleanalytics');
function wpb_add_googleanalytics() { ?>
 
// Paste your Google Analytics tracking code from Step 4 here
 
<?php } ?>

Non dimenticate di sostituire la sezione “Incolla qui il tuo codice di monitoraggio di Google Analytics dal punto 4” nello snippet qui sopra con il tuo codice di Google Analytics.

Visualizzazione dei rapporti in Google Analytics

Google Analytics è in grado di mostrare un tesoro di dati raccolti dalle vostre statistiche. È possibile visualizzare questi dati visitando la dashboard di Google Analytics.

Nella colonna di sinistra vengono visualizzati i rapporti integrati di Google Analytics. Ogni sezione è suddivisa in diverse schede e facendo clic su una scheda la si espande per mostrare ulteriori opzioni.

GA4 reports

I rapporti diGoogle Analytics 4 sono leggermente diversi dai precedenti rapporti di Universal Analytics. Nella colonna di sinistra è presente un’opzione dedicata ai rapporti. I rapporti sono raggruppati in due grandi categorie, tra cui Ciclo di vita e Utente.

Una delle differenze più evidenti nei rapporti di GA4 è l’assenza della metrica della frequenza di rimbalzo. A parte questo, troverete una nuova interfaccia di reportistica, nuove metriche come il tempo di coinvolgimento, nessun obiettivo in GA4 e altro ancora.

Ecco una panoramica dei diversi report di Google Analytics 4:

  • Il rapportoRealtime è simile a Universal Analytics e mostra gli utenti attivi sul vostro sito in tempo reale.
  • Il rapporto sulleacquisizioni mostra quale mezzo utilizzano gli utenti per trovare i vostri siti web, come ad esempio i siti organici, i referral, le e-mail e gli affiliati.
  • Il rapporto sulcoinvolgimento mostra le conversioni e gli eventi che si verificano sul vostro sito.
  • Il rapporto sullamonetizzazione mostra tutti i dati relativi al commercio elettronico in un unico posto, insieme a nuovi rapporti come gli acquisti in-app e gli annunci dei publisher.
  • Il report sullaretention mostra fondamentalmente i nuovi visitatori rispetto a quelli che ritornano e aiuta a ottenere informazioni sulla retention degli utenti.
  • Il rapportodemografico consente di visualizzare il traffico del sito web dai principali Paesi, città e altro ancora. Mostra anche la ripartizione per sesso e i rapporti sugli interessi.
  • Il rapportotecnico mostra quale dispositivo, browser, sistema operativo, versione dell’app e dimensione dello schermo viene utilizzato maggiormente dalle persone per visualizzare il vostro sito web.

Sfruttare al meglio Google Analytics

Google Analytics è uno strumento incredibilmente potente, dotato di moltissime funzionalità. Alcune di esse sono abbastanza ovvie e facili da usare, mentre altre richiedono una configurazione aggiuntiva.

Ecco alcune risorse che vi aiuteranno a sfruttare al meglio i rapporti di Google Analytics.

Google Analytics funziona al meglio con Google Search Console (ex Google Webmaster Tools). Permette di vedere come si comporta il vostro sito web nei risultati di ricerca. Consultate la nostra guida completa su Google Search Console per scoprire come usarlo per far crescere il vostro sito web.

Se volete migliorare il posizionamento SEO di WordPress e ottenere più traffico, vi consigliamo di utilizzare il plugin AIOSEO per WordPress, un kit di strumenti SEO completo.

È disponibile anche una versione gratuita di AIOSEO.

Questo plugin vi aiuterà a ottimizzare completamente il vostro sito WordPress con un corretto schema di markup, sitemaps e tutto ciò che vi serve per migliorare le vostre classifiche SEO.

Speriamo che questo articolo vi abbia aiutato a capire come installare Google Analytics in WordPress. Potreste anche voler consultare la nostra guida su Google Analytics vs. Jetpack Stats o la nostra scelta di esperti delle migliori soluzioni di analisi per WordPress.

Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e Facebook.

Divulgazione: I nostri contenuti sono sostenuti dai lettori. Ciò significa che se cliccate su alcuni dei nostri link, potremmo guadagnare una commissione. Vedi come WPBeginner è finanziato , perché è importante e come puoi sostenerci. Ecco il nostro processo editoriale .

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Il kit di strumenti WordPress definitivo

Ottenete l'accesso gratuito al nostro kit di strumenti - una raccolta di prodotti e risorse relative a WordPress che ogni professionista dovrebbe avere!

Reader Interactions

845 commentiLascia una risposta

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. jinson

    Hai.. I edited header.php file for Verifing Google Analitycs for my WordPress blog http://lastly.org. But after that it shows “The Google Analytics tracking code has not been detected on your website’s home page.” I tried after half an hour still the same result.
    Finally I used “Insert Header footer plugin and get the result.
    Thanks Syed.

  3. Akhil

    Actually I am using one WordPress plugin Google Analytics as I don’t want display the results on my website but I want them on WordPress itself. I have installed and configured the plugin successfully, one day it showed some visits on my websites but today it is showing same status as if no one has visited the website. But my friends have visited the website, that I have confirmed. What could be the issue?
    As someone said that google may take 3 to 4 hours to update the status, I waited. But the whole day has passed, still it is not showing any update.

    Thanks

  4. Aarish Maluja

    I have done everything right.It is showing everything ok but the data is not increasing from last month.my website is http://www.tecq.in.please help.

    • WPBeginner Support

      Aarish, Google Analytics code can not be found on your site. Please refer to second section of the article and choose another method to insert code into your WordPress site.

      Admin

  5. aarish

    i installed the tracking info correctly but the data is not increasing .It is not showing any visits.still on zero

    • WPBeginner Support

      Check your Analytics dashboard, does it detect code on your site? Generally, when Google Analytics is added to a site for the first time it may take a while before you can see any data.

      Admin

  6. Misty Young

    Thank you so much for your simple instructions! I was able to generate the Google Analytics code quickly and found the right spot in my theme to insert it within a couple minutes. Very helpful, thank you again!

  7. Vince

    Hi…I installed the ‘insert headers and footers’ plug-in to my wp and copied my Google Analytics code to the footers box under settings, clicked save but GA is telling me the tracking is not installed. I did this 24 hrs ago. Did I do something wrong? Can you help?

    • WPBeginner Support

      can you see the analytics code in your site’s source code? You can view source by visiting your site, right clicking on any empty space and selecting view source from the menu. On the view source scroll down the document and see if you can find Google Analytics code there. Alternatively, you can try the second method described in the article.

      Admin

  8. Mary

    I liked this post because anything to do with google seems to be quite complicated

    But I tried the plugin you recommended but GA wasn’t tracking.

    SO I just put the code on the page and it still isn’t tracking.

    Any advice? Thanks Mary

  9. Mary

    Thank you for this post, but google analytics isn’t showing up on my site

    I pasted the code into the footer of the “header and footer plugin”.
    It was blank.
    I saved the changes.

    But where will I find the analytics page? There is nothing labled google analytics.
    Thanks Mary

    • Mehul

      Let me know if you need help. I will be happy to help you in installing the Google Aanalytics Code on your website.

    • Alo Knows

      You’ll find all the Analytics data on your GA Account. Not on wordpress.

  10. Latreasa

    Can I add it to WordPress.com blog if my domain is hosted by godaddy.com? I would like to do this without having to change my blog to WordPress.org

    Regards

  11. Alin

    If you install Google Analytics Dashboard for WP you will be able to display Google Analytics data and statistics, in a chart, inside your WordPress Blog.

  12. Eddy

    Very useful post. I have a problem I install the GA wordpress plugin and when I go to the Settings > Google Analytics don’t show me anything only the title “Google Analytics for WordPress Configuration” what’s wrong with this? please I need help

  13. Zoe

    Thank you for this tutorial.

  14. Lula

    Someone should really mention at some point that if you’re using wordpress.com (not wordpress.org) and you don’t have a separate software purchased for your sites hosting you CANNOT add google analytics there is no ability to add your own plugins. I think they think it’s better for wordpress to handle everything but I would have liked to have known this before starting.
    :X

    • Editorial Staff

      Sorry Lula, we have written numerous posts about the differences, but we simply cannot add on every article that this tip is only for WordPress.org users. All articles written on this site is intended for self-hosted WordPress users.

      Admin

  15. Ann

    Thanks for the helpful tutorial. I installed GA using your plugin about a week ago and the page views that GA is showing are significantly less than what Jetpack is telling me. Page views according to GA are roughly half of page views per Jetpack. Is this typical?

  16. Anna

    Hi
    Thanks for the great simple instructions for beginners like me.
    I have installed this plugin successfully and activated it but I am unable to add the Google Analytics code as there is no Settings option!
    Under the Plugin name I only get two options: Deactivate or Edit
    I am probably being stupid but where can I find the plugin Settings option?
    Many thanks for your help

    • Noumaan Yaqoob

      @Anna the plugin settings are located under Settings > Insert Headers and Footers.

  17. Fran

    Status: Tracking Not Installed
    Last checked: Jun 16, 2013 7:44:16 PM PDT
    The Google Analytics tracking code has not been detected on your website’s home page. For Analytics to function, you or your web administrator must add the code to each page of your website.

    I used the header/footer plug in, followed instructions, and received this code.
    What should I do now? I’m hosted WP btw.

    • Editorial Staff

      Depending on the theme you are using, it may not have the default wp_head(); or wp_footer(); functions in place. Also if you have a caching plugin installed such as WP Super Cache or W3 Total Cache, then you need to empty the cache.

      Admin

      • Jesse

        If the theme is not compatible with header / footer plug-in for analytics, is best to then copy the script manually into every page or is there a way to add the format required to the theme? Thanks!

        • WPBeginner Support

          No, you can still add the code in your theme’s footer.php file just before the /body tag.

  18. Kristina Larse

    Hi
    I added the tracking code to the header useing the plugin – i went in to my webshell and found the function.php file (in the them folder)- pastede

    // Placede my code here and removede the //

    But no matter where i try to paste it in the begingne, the end, efter the first break – the site just breaks down.

    Any idea whaat im doeing wrong?

    • Kristina Larsen

      //The code i pastede was like this

      // Placede my code here and removede the //

      //

  19. Waheed

    Thanks For This Great Tutorial :)
    I have One Question… i installed The Header and Footers Plugin, So Now I have To paste the Google analytic script In Header of the Plugin setting or Both Header and Footer?

    Thanks in advance?

  20. Chaotic Kristy

    Thanks this helped me out a lot

  21. Adam Moustafa

    I tried the plugin and the direct method but it still says tracking not installed.

    From the google analytics plugin on WP i do get information, though. Any help would be greatly appreciated.

  22. Mahmudul

    Thanks for this helpful post :D

  23. Matthew P. Schneider, LC

    What are the advantages of this over Site stats using JetPack. I have a self-hosted blog but use WordPress.com statistics that are available in the JetPack plugin.

    • Editorial Staff

      Google Analytics is far more advanced and give you much more data. However for some beginners it can get a little complicated. Jetpack Stats give simple data, but its easy to use.

      Admin

  24. Tiffany

    I can’t find my footer or available plugins. Is there a real step-by-step once you are in your wordpress blog ‘for dummies’? Help!

    • Editorial Staff

      If you can’t add plugins, then you are probably using WordPress.com. This will only work for self-hosted sites.

      Admin

  25. TJ Ellis

    Amazing blog post it worked nicely! Thanks again

  26. Lanaya Green

    That is what it is about getting useful information thanks for the details it makes it so simple to have something you can follow step by step… Thank you rock on brother

  27. leo wolf

    Thank you for the clear stepwise description. I had already an account with Google Analytics showing the results on the website. Now I copied the script code in the functions.php, so far so good. Where and when can I expect the GA output now? Is it displayed in the footer?

    BTW: I don’t use a standard theme, but one built from scratch so maybe I miss something?

    Thnx in advance, Leo

    • Editorial Staff

      The output is not visible unless you view the source code of the page. You should see it towards the bottom in the source code.

      Admin

      • leo wolf

        The title of this post suggests that you can have GA data at your site. But if is not visible, what’s the use then?

        • Editorial Staff

          Most tracking software will NOT make your data visible to the general public. Google analytics is a tracking software. You install it on your WordPress site, so you can get better insights about your audience. Google analytics works silently behind the scenes to capture data about your audience such as (what time they visited your site, who referred them, which pages they viewed etc).

  28. Louise Bibby

    Thanks so much for this info. It helped me overcome my paralysis with anything related to code. It was really useful!! Cheers Louise

  29. Alan

    Where do you get the code from step 6 if you do not get it the first time? I do not see it again when I log in.

    • Editorial Staff

      Login to Google Analytics. Look in the orange bar where it says Admin. Click on that. Under the accounts, click on the account that you want the code of. Under that account, you will see the property. Click on that property. There you will see a tab for Tracking info.

      Admin

  30. Webbis

    This helped me a lot! But how do I do to measure my subdomains in the same account?

  31. Carly

    I wanted to do the paste. I made it to the footer.php page but there is no tag on that page so I can’t paste before it. What am I missing? Plus, I closed the Google page before reading your instructions not to do so. (I did copy the code.) Do I need to start over with Google? Thanks.

    • Editorial Staff

      No you do not. Just use the plugin we are recommending in the article above, and it will take care of it.

      Admin

  32. Luis

    Thanks! The header and footer plugin helped me a lot!

  33. Naeem

    Thank you for this post.

    I am totally new in blogging and has recently set up a blog using wordpress platform.

    I have set up analytics account and paste the code using my theme’s option.

    Now my account is showing that tracking code installed.

    But the problem is in the audience section it is showing 0 visits while in the real time section it is showing 2 visitors.

    I am totally confused.

    ( My blog is under construction. Me and one of my friend is the only visitor. And I was unable to find single domain option. there are subdomain, mutiple top level domain options but no single domain option.)

    Can you please help me.

      • Michael Hickey

        I’m not at all sure what I am doing so perhaps you can help. Someone else that is not available now laid out my site. I was told to cut and paste the Google Analytics code one line below this last line of each page of my simple WP site. However, I cannot see where to do that for the Home Page. There is not a tab for the Home Page from the Dashboard. Any help is appreciated.

        • Editorial Staff

          Use our plugin that we mentioned, and it will add it on all pages of your site.

  34. Bob

    Does this plugin work retrospectively: that is to say, does it enter the the code into existing headers for pages that I’ve already developed on my WordPress site? I’ve put the script code in the header section and pressed save settings, but I’m not sure that that’s all I need to do.

    Any assistance would be gratefully received.

  35. Ameh

    Hi, great tutorial. Just one question. I have a desktop site and a mobile site. They both use different themes but have the same domain (www.dapopeyoh.com), so do i enter the google code in the footer.php file of one theme or both themes? Thanks.

  36. Saad

    Thank you so much for guiding me. I’ve completed and now waiting for 12-24 hours :)

  37. Omar

    I used the “Insert Header and Footer” plugin and pasted the google analytics code into the header in the settings of the plugin. I saved the settings and when I log into google analytics, the status is still “tracking is not installed.” Did I do something wrong and do I simply have to wait a while?

    • Editorial Staff

      If it is not working, then it means that your theme does not have wp_head(); in the header.php which is a standard for all WP themes.

      Admin

      • Ryan

        So how would we be able to include the wp_head(); to the site?
        I have the same issue (I think) – tried different ways but tracking still stating not installed.

        • Editorial Staff

          It is supposed to be included in your theme’s header.php file in the head markup.

  38. David

    We have just started a WP blog as a sub-directory to our main site. We used the main site analytics code in the WP blog but I am not seeing any information about the pages visited in the blog. Should we create a separate analytics account for the blog sub-directory? If so, will that show us information about where visitors move from the blog to the main site?

  39. Monetsky

    Hi. Thanks for this tutorial. It simplified my life using the plugin to insert the code. I was wondering thoughif theres a way to get previous months data into google analytics? I only installed the code now and opened an account. Just wondering.. Thanks in advance. Great work!

    • Editorial Staff

      It cannot show you the data of things it didn’t track. The only way google can give you the data is if their script is on your page. Otherwise, they can’t.

      Admin

  40. Bob Furber

    I followed the instructions to pate in footer.php, and the Tracking status shows “Receiving Data”.

    However, when I go to the bottom of the Word Press Dashboard, to the Google Analytics Dashboard Widget, there is a note:

    “You need to log in and select an account in the options panel.”

    On clicking the options panel or Settings -> Google Analytics Dashboard, I get the following error:

    “Error gathering analytics data from Google: GDatainsufficientPermissionsUser does not have any Google Analytics account. Please try again later.”

    The problem is later does not arrive and I can find no way out.

    • Editorial Staff

      The issue you are describing is with a specific plugin that you are using “Google Analytics Dashboard Widget”. You should ask that question in their support forum.

      Admin

  41. Lisa - Une Belle Vie

    Hey, amazing that this is possible, but is google analytics replacing the normal wpstats ? Do you lose your views and information from that ?
    Thankyou!

    • Editorial Staff

      WP Stats is not a built-in WordPress plugin in self-hosted WordPress. Google Analytics is definitely a more robust platform.

      Admin

  42. Lynette Chiang

    When you open Settings>Insert Header and Footer, there are two fields. You don’t specify above whether the code is to go in one field or both.

  43. marie

    My Google Analytical has stopped tracking and is showing all 0’s for the past week. Can you advise why?

    • Editorial Staff

      Is the code still added in your site? Did you change your theme? The only reason for it to be zero is if the code from your site got removed.

      Admin

      • Savita

        My Google Analytical has stopped tracking and is showing all 0′s for the past week. Can you advise why?
        I looked in the footer if the code is still there, but I don’t remember what the code was or looks like (did not make a note of it so it seems…). It does not look good. So what can I do now?

        Above the in the footer.php it says:

        Thank you.

  44. vida

    hello
    my wordpress site is a free one and i don’t see any option for plugins. The site is http://www.lavidavidzi.wordpress.com i’m wondering if this url has the ability to add plugins. I can’t even find the footer option you’re referring to …am i even able to get google analytics ?

  45. Lauren

    How do I add a plugin? WordPress doesn’t let me edit my coding. I downloaded one of the plugins but how do I get it on my site?

  46. figz91

    I tried to do this and lost everything, I think its because I put in the function.php coding in wrong but did it in the section where it said I was able to add in extra coding anyway.
     
    My site isn’t opening, neither my admin page to correct the problem it just says theres an http 500 error, I’m clueless and scared, is there anyway I can fix this problem? Please help.

    • wpbeginner

       @figz91 Yes, you would need to go through the FTP. Send us an email, and we can help you fix it.

      • Heidi

        The same thing just happened to me, please help me fix this asap!

        • Editorial Staff

          Heidi, you would have to use FTP to fix it. You are probably getting a syntax error because you pasted the code improperly.

  47. AdamCollins

    Aloha, so I signed up for analytics and placed the code in my theme options where there was a spot for my analytics built into the wp theme.  I also have a squeeze page on the blog. part of the domain and wondering do I upload the same code, or do I get another code?  Thanks so much.
     

    • wpbeginner

       @AdamCollins You can use the same code. Because that is on a separate page. You can see traffic by pages in Google Analytics.

  48. buckingham87

    Yeh hi… i tried to follow all this and now i have lost everything! i cant even login to my admin page!!
     
    HELP

    • wpbeginner

       @buckingham87 That probably happened because you pasted the code improperly in your functions.php file. https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/

      • figz91

         @wpbeginner I’m having the same problem Buckingham is and I’m about to breakdown. Regardless of why it’s happening I need to get back my 4 years worth of content and I can’t even get to my admin page let alone the actual site.
         
        Is there anyway to fix this. I’m clueless and have no idea what to do. Please help.

  49. Tommy Stuart

    What exactly does the following mean? I have a website that I put together compliments of Wealthy Affiliate University. Does that mean it’s a self-hosted or is it a free word press site?

    “Note: This is only for Self-Hosted WordPress.org blogs. Free WordPress.com sites cannot use Google Analytics. Maybe it’s time to upgrade from free WordPress.com to Self-Hosted WordPress? Consider using our Free WordPress Blog Setup program.”

    WHICH?

    • wpbeginner

      Go in your WordPress admin panel and click on Appearence > Editor … If you can edit all of your theme files, then you are on self-hosted.

  50. pradeepnairjc

    Very useful post. How should I add tracking in case I am using WordPress as a Subdirectory? For example- http://www.domain.com/blog.

    Do I copy -paste the same tracking code in the footer file or do I need to generate a new tracker code for this? I installed the analytics plug-in and configured it but somehow it never recorded visits although the data was being received successfully.

Lascia una risposta

Grazie per aver scelto di lasciare un commento. Tenga presente che tutti i commenti sono moderati in base alle nostre politica dei commenti e il suo indirizzo e-mail NON sarà pubblicato. Si prega di NON utilizzare parole chiave nel campo del nome. Avremo una conversazione personale e significativa.