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

Så här installerar du Google Analytics i WordPress för Beginner

Att förstå hur besökarna interagerar med ditt content är nyckeln till att uppnå dina mål som ägare av en website. Om ditt mål är att få en lojal läsekrets, öka försäljningen eller auktorisera dig själv som en auktoritet inom din nisch, är det mycket viktigt att ha tillgång till trafikdata för din website.

Det är här Google Analytics kommer in i bilden. Det är ett gratis och kraftfullt verktyg från Google som ger insikter i din publiks beteende. This allows you to make data-driven decisions to improve your website and content strategy.

Under våra 16+ års erfarenhet anser vi att Google Analytics fortfarande är det bästa sättet att lära känna your audience. Vi har också hjälpt många användare att installera och komma igång med Google Analytics på sina webbplatser i WordPress.

I den här artikeln kommer vi att dela med oss av varför Google Analytics är viktigt och hur du enkelt installerar Google Analytics i WordPress (steg för steg).

How to Install Google Analytics in WordPress

Först ska vi förklara varför Google Analytics är viktigt och hur det kan hjälpa dig att utveckla din website.

Därefter visar vi dig hur du registrerar ett Google Analytics account och olika metoder för att installera det på din WordPress site.

Slutligen förklarar vi hur du kan view your traffic reports i Google Analytics.

Här är en snabb översikt över vad du kommer att lära dig i den här artikeln:

Är du redo? Nu sätter vi igång!

Varför är Google Analytics viktigt för bloggare?

När you startar en blogg är ditt främsta mål att få mer trafik och fler prenumeranter. Google Analytics hjälper dig att fatta datadrivna beslut genom att visa dig den statistik som är viktig. You can see:

Vem besöker din website?

Denna del av analytics visar din publiks geografiska location, vilken webbläsare användaren använde för att besöka din site och annan viktig information som skärmupplösning, stöd för JavaScript, stöd för Flash, språk med mera.

Dessa uppgifter är mycket användbara och kan vara till hjälp på många olika sätt. När du skapar en customize website design kan du använda användardata för att se till att din site är kompatibel med din målgrupp.

Om de flesta av dina användare inte har stöd för Flash bör du undvika att lägga till Flash-elementet på din site. Om de flesta av dina användare har en vy med 1280 i upplösning bör du se till att din design är kompatibel med den upplösningen eller mindre.

Vad gör folk när de är inne på din website?

You can track where the users are going on your website, how long they stay on your website, and the bounce rate (the percentage of users who exit your site on the first visit).

Genom att använda den här informationen kan du minska avvisningsfrekvensen och öka antalet sidvisningar.

You can also find your most popular articles, articles that are not doing so well, and the kind of content your users are looking for.

När besöker folk din website?

Genom att titta på de hetaste timmarna på dagen för din site kan du välja den bästa tiden att publicera ditt post. Om den tidszonen inte är kompatibel med din, kan du schemalägga ditt post för den timmen.

Hur hittar folk till din website?

Denna section av analysen visar dig varifrån användarna kommer. Använder de till exempel search engines, enter direct links eller clickar de på referral links från en annan site?

Det visar dig också hur stor andel av dina besökare som kom från var och en av dessa källor. Google Analytics ger dig en uppdelning av var och en av dessa kategorier. Om det är kategorin sökmotor, visar den vilken search engine som gav dig mest trafik, gillar Google, Yahoo, Bing och så vidare.

Uppdelningen av referral sources visar vilka webbplatser du behöver arbeta mest med. Om din högst upp referral source är Facebook, behöver du exklusivt Facebook content för att få din publik att känna sig speciell.

Om din populäraste referral source är en extern website, då kanske du vill överväga att ha ett partnerskap med den webben (utbyte avgästinlägg eller något annat).

Hur interagerar människor med your content?

Google Analytics visar hur dina användare interagerar med innehållet på din site. Det visar dig hur många procent av användarna som klickade på vilken link på din site och mycket mer.

You can run A/B split tests by creating content experiments in Google Analytics to understand what works best to meet your goals.

Genom att se användarnas interaktivitet kan du anpassa ditt content efter dina användare. Genom att se svaren på frågorna ovan kan du fokusera på de strategier som fungerar för din site och undvika metoder som inte fungerar.

Enkelt uttryckt, eliminera gissningarna och fokusera på statistik som är viktig, så att you kan fatta datadrivna beslut.

Video Tutorial

Subscribe to WPBeginner

Om du föredrar skriftliga instruktioner kan du fortsätta Läsa.

Så här registrerar du dig med Google Analytics

Google Analytics är gratis available, och allt du behöver är ett Google eller Gmail account för att registrera dig. Registreringsprocessen är ganska enkel. Följ bara Step-by-Step instruktionerna under för att skapa ditt Google Analytics account.

Step 1: Först måste du besöka Google Analytics website för att registrera dig. När du är på webbplatsen klickar du helt enkelt på knappen ”Kom igång idag”.

Click get started today

Därefter kommer du att bli ombedd att logga in med ditt Google account.

Om du redan har ett Google- eller Gmail-konto kan du använda det för att logga in. Annars kan du gå vidare och skapa ett Google-konto för dig själv.

Sign in using your Google account

Step-by-Step 2: När du har loggat in med ditt Gmail-konto kommer du att se en välkomstvy som gillar den under.

Det är här du registrerar dig för Google Analytics med ditt Gmail account. Gå vidare och klicka på knappen ”Starta mätning”.

Click start measuring button

Efter det kommer du att bli ombedd att ange ett namn på ett account.

Detta namn kommer att användas internt, så du kan använda vad som helst, gillar ditt företagsnamn.

Enter your Google account name

Google Analytics kommer också att visa delningsinställningar för flera konton.

Dessa inställningar ger dig control över delningen av dina Google Analytics-data. Du kan behålla standardinställningarna och gå vidare till nästa steg.

Account data sharing settings

Step 3: På nästa vy måste du skapa en Google Analytics-egenskap.

Google introducerade en new version av Google Analytics som anropas Google Analytics 4 eller GA4. Det är den senaste versionen som trackar din website och dina mobila appar i samma account. Dessutom får du nya funktioner, metrics och ett annat gränssnitt för dina rapporter.

Gå vidare och enter ett fastighetsnamn och välj din tidszon och valuta för rapportering. Klicka sedan på knappen ”Nästa”.

Enter property name

På nästa vy måste du välja en ”Industry category” från dropdown-menyn för din website och välja en ”Business size” från de givna alternativen.

När du är klar klickar du bara på knappen ”Next”.

Enter business details

Därefter måste du välja affärsmål och välja hur du tänker använda Google Analytics med ditt företag. Detta kommer att hjälpa dig att få personliga rapporter för your business.

Till exempel finns det alternativ som gillar att generera leads, driva onlineförsäljning, öka varumärkesmedvetenheten, undersöka användarnas beteende och mer.

You can choose multiple options or all of the given options that meet your needs. Vi rekommenderar att du väljer alternativet ”Get baseline reports” så att du får alla Google Analytics-rapporter i ditt account.

Choose your business objectives

När du är klar klickar du bara på knappen ”Skapa”.

Step-by-Step 4: Nu kommer du att presenteras med dina Google Analytics Webs stream alternativ.

Eftersom vi konfigurerar Google Analytics för en site i WordPress, går du vidare och väljer ”Web” som plattform.

Select data collection option

Efter det måste du enter din website URL och Stream namn.

Som standard har Google Analytics ett alternativ för ”Förbättrad mätning” aktiverat. Detta allow you to track pageviews, scrolls, outbound clicks, file downloads, and more in Google Analytics.

Obs/observera: Om du har planer på att använda pluginet MonsterInsights bör du stänga av alternativet ”Förbättrad mätning”. Annars kommer pluginet att samla in och displaya dubbelt så mycket data.

Därefter kan du klicka på knappen ”Create stream”.

Enter website URL and stream name

You can now see your Stream name, URL, ID, and Measurement ID.

Den kommer också att visa olika förbättrade mätningar som den kommer att posta.

View stream ID and measurement ID

Högst upp ser du också en alert som visar dig hur du addar Google Analytics till din WordPress site.

Gå vidare och klicka på knappen ”View tag tag instructions”. Du bör nu se olika sätt att add to Google Analytics tracking code till din WordPress website.

View Analytics installation instructions

Därefter kan du växla till tabben ”Installera manuellt”.

Du kommer då att se koden för tracking i Google Analytics.

Install GA code manually

Gå vidare och kopiera denna tracking-kod eftersom du kommer att behöva enter den på din WordPress site beroende på vilken metod du använder under. Du kan också helt enkelt lämna den här tabben i webbläsaren öppen och växla tillbaka för att kopiera koden när det behövs.

Vi föreslår att du låter fliken Analytics i webbläsaren vara öppen, eftersom du kan behöva gå tillbaka till den när du har installerat koden på din WordPress site.

Nu när du har skapat ett Google Analytics account ska vi klura ut hur du installerar Google Analytics i WordPress.

Så här installerar du Google Analytics i WordPress

Det finns några olika sätt att ställa in Google Analytics i WordPress. Vi kommer att visa dig tre metoder där det första alternativet är det enklaste och det sista är det svåraste.

You can choose the one that best suits your needs.

Note: Du behöver bara använda en av dessa metoder på din website för att undvika dubbel tracking av sidvisningar i ditt Google Analytics account.

Metod 1: Google Analytics för WordPress av MonsterInsights

MonsterInsights är det mest populära Google Analytics-tillägget för WordPress. Över 3 miljoner websites använder det, inklusive likes som Bloomberg, PlayStation, Zillow, WPBeginner, och många fler.

Det är det enklaste och överlägset bästa sättet att add to Google Analytics till WordPress (för alla användare, både Beginner och experter). MonsterInsights är available både som ett betalt premium plugin och en gratis version. I denna tutorial kommer vi att använda den gratis versionen av MonsterInsights.

Du kan använda versionen MonsterInsights Pro om du vill ha mer avancerade funktioner som gillar ecommerce tracking, ads tracking, author tracking, och så vidare. Processen för att ställa in dem är densamma.

För mer information kan du se vår kompletta MonsterInsights review.

Låt oss komma igång.

Det första du behöver göra är att installera och aktivera pluginet MonsterInsights. För mer detaljer, se vår Step-by-Step guide om hur du installerar ett plugin för WordPress.

Vid aktivering kommer pluginet att lägga till ett new menu item märkt ’Insights’ till din WordPress admin menu, och du kommer att se en välkomstvy. Gå vidare och klicka på knappen ”Launch the Wizard”.

Launch setup wizard

Om du klickar på den öppnas installationsguiden för MonsterInsights.

Först kommer du att bli ombedd att välja en kategori för din website (en företagswebbplats, blogg eller online store). Välj en och klicka sedan på knappen ”Save and Continue”.

Choose what describe your website

Därefter måste du ansluta MonsterInsights till din WordPress website.

Klicka bara på knappen ”Anslut MonsterInsights”.

Connect MonsterInsights with your site

Du kommer då till Google accounts, där du ombeds logga in eller välja ett Google account om du redan är inloggad.

Gå vidare och välj ditt Google account eller enter din email för att logga in.

Choose Google account to sign in

Därefter kommer du att bli ombedd att allow MonsterInsights att komma åt ditt Google Analytics account.

Klicka på knappen ”Allow” för att fortsätta.

Allow access to your Google account

Nästa steg för att completed anslutningen är att selecta den profil du vill track.

You need to select your website here and then click on the ”Complete Connection” button to continue.

Connect analytics with your site

Efter det klickar du bara på knappen ”Complete Connection” för att fortsätta. MonsterInsights kommer nu att installera Google Analytics på din website.

Därefter blir du ombedd att selecta de rekommenderade settings för your website.

Recommended settings

Standardinställningarna fungerar för de flesta websites. Om du använder ett plugin för affiliate-länkar måste du add to den sökväg du använder för att dölja affiliate-länkar. Detta kommer att allow you att spåra dina affiliate länkar i Google Analytics.

MonsterInsights kommer också att fråga vem som kan se rapporterna. Du kan välja olika roller för användare i WordPress.

När du är klar klickar du bara på knappen ”Save and Continue” för att spara dina Settings.

Who can see the reports

Därefter kommer MonsterInsights att visa dig en lista över funktioner för tracking av websites som du gillar att aktivera.

You can scroll down and click on the ”Continue” button or the ”Skip for Now” alternative.

Choose which tracking features to enable

På nästa vy kommer MonsterInsights att visa att du utan problem har ställt in Google Analytics tracking.

Du kan se att Google Analytics är anslutet, spårningskoden är installerad och data samlas nu in.

Tracking should be all setup

Därefter kan du rulla ner och se ett fält där du kan enter din license key.

Fortsätt och klicka på alternativet ”Complete Setup without Upgrading” för nu.

Continue setup without upgrading

Du har utan problem addat Google Analytics till din website i WordPress.

Inaktivera förbättrad mätning i Google Analytics

Nu, om du skapade en dataström i GA4 på egen hand istället för att låta MonsterInsights skapa en, måste du stänga av Enhanced Measurement.

Det beror på att MonsterInsights addar flera utvalda funktioner för förbättrad tracking. Om du låter alternativet Förbättrad mätning vara aktiverat kommer dina data att förvrängas och felaktiga resultat visas.

Först kan du heada till Google Analytics tabs eller fönster i din webbläsare. Härifrån klickar du på alternativet ”Admin” settings längst ner i det vänstra hörnet.

Switch to admin view in Google Analytics

När du är på sidan ”Admin” ser du olika Settings.

Klicka helt enkelt på alternativet ”Data Streams”.

Go to admin and data stream settings

Därefter kommer du att se dina Data Streams.

Välj bara den dataström som du har anslutit till MonsterInsights.

Select your data stream

På nästa vy måste du inaktivera alternativet ”Förbättrad mätning”.

För att göra det klickar du helt enkelt på toggle.

Disable enhanced measurement

Därefter öppnas ett popup-fönster som bekräftar att du gillar att stänga av den förbättrade mätningen.

Gå vidare och klicka på knappen ”Stäng av”.

Click turn off button for enhanced measurement

Ändra Settings för datalagring i Google Analytics

Som standard kommer Google Analytics att ställa in datalagringsinställningen till 2 månader. Du kan dock ändra detta så att du kan använda dina data i customize-rapporter längre än 2 månader.

Först måste du heada till Admin ” Data Settings ” Data Retention in Google Analytics.

Open data retention settings

Därefter kan du clicka på dropdown-menyn ”Event data retention”.

Här väljer du bara alternativet ”14 månader” och clickar på knappen ”Save”.

Change data retention settings

Kom ihåg att det tar lite tid innan Google Analytics visar din statistik.

View Google Analytics Reports i WordPress dashboard

Det bästa med MonsterInsights är att du kan view dina Google Analytics-rapporter i WordPress dashboard.

Besök bara sidan Insights ” Reports för att kontrollera en snabb översikt över dina analysdata.

Dashboard reports

Du kan också add annotations direkt till dina MonsterInsights rapporter för att registrera viktiga ändringar du gör på din website.

Du kan till exempel lägga till en note när du publicerar ett nytt blogginlägg, lägger till en ny landing page och så vidare. Det gör det enkelt att tracka hur dessa händelser påverkar din trafik.

View your site notes under the report

För mer detaljer, se den här guiden om hur du får GA4 site annotations i WordPress.

Dessutom kommer det med en Popular Posts addon som tillåter dig att visa ditt högst upp utförda content för att öka din trafik och sidvisningar.

MonsterInsights Popular Posts Widget

Du kan använda den för att automatiskt add to inline populära posts links för att öka engagemanget.

Om du driver en onlinebutik kan den också automatiskt lägga till dina populäraste inläggen / bästa inläggen i slutet av varje blogginlägg för att öka försäljningen:

MonsterInsights popular products

Note: MonsterInsights var tidigare känt som Google Analytics för WordPress by Yoast. WPBeginners grundare, Syed Balkhi, förvärvade tillägget 2016 och döpte om det till MonsterInsights. Nu är det en del av vår familj av premium WordPress tillägg.

Metod 2: Installera Google Analytics i WordPress med WPCode

Den här metoden är inte lika bra som MonsterInsights eftersom du inte kommer att kunna konfigurera avancerad tracking och du kommer ej att kunna view Google Analytics-data i WordPress dashboard.

Först måste du kopiera din Google Analytics tracking-kod (Global site tag) som du kopierade i steg 4 tidigare när du skapade ett Google Analytics account.

Install GA code manually

Därefter måste du installera och aktivera WPCode plugin. För mer detaljer, se vår Step-by-Step guide om hur du installerar ett WordPress plugin.

Efter aktivering måste du besöka Code Snippets ” Header & Footer page. Här måste du klistra in spårningskoden för Google Analytics som du kopierade tidigare i sektionen ”Header”.

Enter tracking code in header using WPCode

Glöm inte att klicka på knappen ”Save Changes” för att lagra dina inställningar.

Alltså har du utan problem installerat Google Analytics på din site.

Metod 3: Installera Google Analytics i WordPress Theme

Den här metoden är för avancerade användare som är bekanta med koden. Den är något opålitlig eftersom din kod kommer att försvinna om du byter eller updaterar temat.

Vi rekommenderar nästan aldrig att du använder den här metoden.

Om det här är första gången du lägger till kod i dina WordPress-filer bör du kontrollera vår guide om hur du kopierar och klistrar in code snippets i WordPress.

Först måste du kopiera spårningskoden för Google Analytics som du kopierade i steg 4 tidigare. You can view it in the Web Stream Installation section under the ”Install manually” tabs.

Install GA code manually

Nu finns det två vanliga sätt att add denna kod till dina WordPress theme-filer. You can choose either one of them (not both).

1. Add Code in header.php File

Bara edit header.php filen i din WordPress tema och klistra in Google Analytics tracking koden som du kopierade tidigare direkt efter <body> taggen.

Glöm inte att save dina ändringar och uploada filen tillbaka till din server.

2. Add via Functions File

Du kan också add to Google Analytics tracking code till WordPress functions file. Spårningskoden kommer då automatiskt att addas till varje page på din WordPress site.

You will need to add this code to your theme’s functions.php file.

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

Glöm inte att ersätta ”Klistra in din Google Analytics-spårningskod från steg 4 här” i ovan snippet med din Google Analytics-kod.

View av rapporter i Google Analytics

Google Analytics är capability att visa dig en skattkista av data som samlas in från din statistik. You can view this data by visiting your Google Analytics dashboard.

Du kommer att se de built-in Google Analytics rapporter i den vänstra column. Varje section är indelad i olika tabs, och om du clickar på en tabs förstoras den för att visa fler alternativ.

GA4 reports

Google Analytics 4-rapporter skiljer sig lite från tidigare Universal Analytics-rapporter. I den vänstra columnen ser du ett särskilt alternativ för Reports. Rapporterna är grupperade under 2 breda kategorier, inklusive livscykel och användare.

En av de mest notice skillnader du hittar i GA4 rapporter är att det inte finns någon bounce rate metric. Förutom det hittar du ett nytt rapporteringsgränssnitt, nya metrics som gillar engagement time, inga mål i GA4 och mer.

Här är en uppdelning av olika rapporter i Google Analytics 4:

  • Realtime report liknar Universal Analytics och visar aktiva användare på din site i realtid.
  • Acquisition report visar vilket medium användare använder för att hitta your websites, gillar organisk, referral, email och affiliate.
  • Engagement report visar konverteringar och händelser som äger rum på din site.
  • Monetization-rapporten visar all din ecommerce-data på ett ställe, tillsammans med new reports som gillar köp i appen och publisher-annonser.
  • Retention report visar i princip nya vs. återkommande besökare och hjälper you att få insikter om hur användare stannar kvar.
  • Demographics report hjälper you att se trafiken på websites från länder, städer med mera högst upp. Den visar också rapporter om könsfördelning och intressen.
  • Tech report visar vilken device, webbläsare, operativsystem, app-version och storlek på vy som folk använder mest för att view your website.

Få ut mesta möjliga av Google Analytics

Google Analytics är ett otroligt kraftfullt verktyg med massor av awesome features. Vissa av dem är ganska uppenbara och användarvänliga, medan andra är obligatoriska att installera.

Här är några av de resurser som hjälper dig att få ut det mesta av Google Analytics rapporter.

Google Analytics fungerar bäst med Google Search Console (tidigare Googles verktyg för webbansvariga). It allows you to see how your website is doing in search results. Se vår kompletta guide till Google Search Console för att lära dig hur du använder den för att utveckla din website.

Om du vill förbättra din WordPress sökmotorsoptimering ranking och få mer trafik, rekommenderar vi att du använder AIOSEO plugin för WordPress, som är en allt-i-ett SEO verktygslåda.

Det finns också en gratis version av AIOSEO som du också kan använda.

Detta tillägg hjälper dig att fullt ut optimera din WordPress site med korrekt schema markup, sitemaps, och allt du behöver för att förbättra din sökmotorsoptimering ranking.

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du installerar Google Analytics i WordPress. Du kanske också vill se vår guide om Google Analytics vs. Jetpack Stats eller vårt expertval av de bästa analyslösningarna för WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

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.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

848 kommentarerLämna ett svar

  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.

      Administratör

  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.

      Administratör

  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.

      Administratör

  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.

      Administratör

  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.

      Administratör

      • 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.

      Administratör

  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.

      Administratör

  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.

      Administratör

      • 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.

      Administratör

  30. Webbis

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

    • Editorial Staff

      When getting your code, it has an option for subdomains there.

      Administratör

  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.

      Administratör

  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.

      Administratör

      • 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?

    • Editorial Staff

      Yes, there is an option in Google Analytics to get subdomain analytics code.

      Administratör

  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.

      Administratör

  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.

      Administratör

  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.

      Administratör

  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.

      • Kate Dewfall

        Hi there,

        I added the code into the footer – is this incorrect or will it still work?

  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.

      Administratör

      • 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?

    • Editorial Staff

      Please refer to our Videos that will show you how to add plugins in WordPress.

      Administratör

  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.

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.