Google Analytics is the most powerful website analytics tool out there (and it is free). In this video I will walk you through the entire set-up process, from the initial account set-up.

To set up Google Analytics, you simply need a Google Account. You can either use an existing gmail or Google + account and connect your analytics to that (easiest) or you can create a brand new Google account within the set-up.

Here is the link to Google Analytics:

http://google.com/analytics

Once you have the account set-up, you will be adding the provided "code" to your websites header.php file which is found under Appearance => Editor inside of your WP-Admin area.

If you have any questions about the set-up process, please leave a comment below and I will be more than happy to help you out.
Join the Discussion
Write something…
Recent messages
moniquerene Premium
One of my 2 sites was already set up automatically with XML installed. I didn't have to put in tracking code. The other I also had installed XML, but manually added the code today and set up a second account, then deleted it, then added it to current account in Analytics . . oh boy . .

Anyway. I'll see if it all works tomorrow. One minute I could see myself on my sites. Next minute no. . .
Reply
JJustice1 Premium
This is what I get when I click editor, under appearance.

Editing core Theme files should only be done if you are experienced in the PHP Programming Language.
By default, theme editing is turned OFF to protect you. If editing is something you require, please contact us to have editing enabled.
Reply
Andy3568 Premium
I got the same thing when I tried to add Google Analytics.

There's an alternative way to add it. You can see how here:
Reply
Wayne66 Premium
Time for an updated video on Google Analytics, Maybe??:)) The process of where to put the code doesn't seem to have changed but the looks of GA changed a lot since 2013.

Maybe that's something coming down the road. Just sayin:)

PS. I need to change the country and time zone portion. could anyone help me with that??
Reply
Sylvain34 Premium
Yes that could be great actually to have an update on GA for members starting.
Reply
Magieken Premium
Hay has actually touched on Analytics recently so you could try watching one of his videos.
Reply
Wayne66 Premium
Thanks for your help, Labman. I actually did find this video andthe code is in. Mission accomplished.

Thanks again and all the best.
Reply
Sierra8 Premium
Every time I go to appearance>editor it takes me to an error page. I've turned my computer off and on and reloaded the page and nothing seems to work. I have no idea how to add this to the header theme; so I added the UA to the SEO plugin but that doesn't work as I can't see any traffic to my site even after I visit it.
Reply
MsMerry Premium
It can take awhile to see any traffic but sure confused as to why you are seeing an error page. Give it a bit of time and recheck it. If it still continues you can always check with support unless someone here sees this and can help out with an idea.
Reply
Sierra8 Premium
okay thank you, I'll try again tomorrow hopefully it'll work.
Reply
MsMerry Premium
Hope it is working today Sierra. All the best........
Reply
Sierra8 Premium
It's not. I've given up on trying to make it work. I'll use the Keyword Tool to know what pages I should focus on.
Reply
MsMerry Premium
So sorry. If you want to have an awesome keyword assistant and SEO helper you could try Squirrly. Here is a post that might help explain it a bit. You can use it free too.
https://myaffiliatehomebiz.com/best-seo-wordpress-plugins
Reply
MsMerry Premium
found this and it may help
Reply
Sierra8 Premium
I'll def give it a try
Reply
MsMerry Premium
I hope it helps you. I see a lot of people having issues so you are not alone. Heck, it was a real pain for me. One little goof and out it goes. Google is a love hate relationship! LoL
Reply
Sierra8 Premium
Yeah, I'm sure. They seem to update a lot of things that aren't the same as the videos here on WA. But I hope this works this go round.

I'll def let you know when I get to it.

right now just catching up on all the emails since I've been busy all day.
Reply
MsMerry Premium
Just happy I got back to you with something that might help. No rush I am doing a catch up as well. Nite....
Reply
JIllW Premium
I entered the google analytics tracking code into the editor of my WordPress website, but do I also need to go into each page and enter the script code for google analytics to get full results or is this a done deal with entering the script code in one place in editor
Reply
Magieken Premium
Once you put the tracking code into your WordPress editor you do not have to do anymore. Analytics can then track visitors to all your pages.
Reply
JIllW Premium
Ok, thank you, for your reply, I did watch the video and I was questioning in google analytics where we copy and paste the script code into WordPress editor in the header PHP this I have done and all is well I am just questioning in google analytics it referred to pasting the code in each page that we wanted to have analyzed. So we do not have to do this the whole site will be looked at without putting the code in each page?
Reply
Magieken Premium
Yes, that is right. Once you have put it in your Header PHP you will see what traffic is coming to all your pages and posts.
Reply
Foobard Premium
Margaret is completely correct, but I'd like to add that the code in your header runs every time someone views any of your web pages. You technically COULD put the code instead on every page (that's what some people did a long time ago in the days before PHP), but putting it once in the header is the most efficient and easiest to maintain.
An alternative that some people follow is to put their Google Analytics ID into their SEO plugin, but I don't want to confuse you. Just follow the training, and you can decide for yourself what is best.
Reply
Foobard Premium
Ok, so after reading the comments and doing some research, I know that you can just add your Google Analytics code to the SEO All-in-one plugin, and you won't have to redo it the next time you update your theme. It also has the added benefit of not hosing your website if you aren't careful.
I do know that there are some GA plugins that integrate Analytics into your WordPress dashboard, but I'm not really into that.

But my research did not answer a question I have: is there a performance benefit to adding it directly to the header.php file? or for that matter, the functions.php file?
Reply
unclesam747 Premium
I can't imagine there being any performance change. It's not like you added another plugin, and if there was any change, it would likely be so minimal that it's not worth worrying about
Reply
Foobard Premium
Thanks! Yeah, that makes sense, since we have that SEO plugin installed anyway. They keep telling us that we should minimize the number of plugins running. I deactivate ones that I don't need all the time. Then I activate them temporarily when I need them. Less running plugins is also probably better for security.
The one downside I see to this is if Google changes their code, then the plugin you use will have to update their own. Never use a Google Analytics plugin that hasn't been updated in a long time.
Reply
prime1 Premium
Kyle I need Help!
I followed the above video and pasted the code accordingly but it is not updated under real time - overview to show anything as it is still at zero????

<head>
[removed]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m[removed].insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-97510386-1', 'auto');
ga('send', 'pageview');

<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>

[removed]
Reply
Labman Premium
Why do you need to enter it manually, just add the UA code to the All In One SEO pack and you are done.
Reply
amgolf Premium
I add code to Yoast SEO, in the plugin space.
Reply
varleysheen Premium
I cant find where you add in yoast
Reply
prime1 Premium
Thank You It worked!
Reply
JackieSmith Premium
Hi Kyle,
Where in the header.php file do we add this code? Is it the verification code that is displayed after we have uploaded the html file to the server? I'm not sure if this is related but I added my website to the Webmaster tool about a week ago. I have since updated the theme but when I go into the Webmaster tool, it's still showing the old theme, so I readded the site..it's still showing the old theme. When I go to Google Analytics, even though I am on my website, it doesn't show that there is an active user. Can you please help/advise.

I'm using Yoast NOT the ALL in One SEO. The site in question is hosted here.
Another site of mine that is hosted elsewhere and is using Yoast seems to be working fine in that it shows the Active user count correctly.
Thanks
Reply
Chezbrown Premium
Hi Jackie, if you haven't managed to get this sorted out yet, go to Marion Black and she has an excellent training for this. I found it easier than Kyle's to follow. xx
Reply
MsMerry Premium
Did you also refresh your site after the changes? I use Yoast as well and had no issues. It is probably something simple and you will laugh about it later. :)
Reply
JackieSmith Premium
Thanks Chezbrown. Yes. I was following Marion Blacks training which are brilliant. I will review them again.
Reply
JackieSmith Premium
Thanks MsMerry. I do not have a problem with Yoast on my non- WA hosted site. The problem is with the site hosted here. Even when I remove the site from Webmaster Tools and add it again, it still shows the template I used when I first registered the site so I'm thinking it's something on the WA end. I will try again, maybe third time lucky.
Reply
KachinaB Premium
I actually had to add my tracking number in my All in One SEO. I did not see the "header" tab in my editor section of my website. I didn't want to break my website so I tried another method. This one works just as well. I wanted to share that to everyone who may have seen something different. Check out the link below for more info
Reply
Gerlinde Premium
You are right! I prefer this option as well! Otherwise with every theme update you have to do it again...
Thanks for the link!
Gerlinde
Reply
WAwannab Premium
It seems okay, however, I don't see a #1 even after going on my site. I did have analytics before getting to this lesson and with the help from Jays training, I am now better able to see and understand the traffic. According to what I am seeing on Analytics, it seems to be working correctly, though.
Thanks Kyle!
Reply
Lilika84 Premium
Thanks, Kyle.
I installed this a few weeks ago; it was a bit different process (as I remember I haven't added code in the WP editor)
Anyways, wanted to ask if it is a mistake to have it installed again (this time I added the code as per your training).
Now I have two accounts for one site.
Is that ok?

Thanks you :)
Sunny
Reply
MNorton Premium
Hi Kyle,
I'm so excited!! I installed Google analytics to my site, tested it and it works!! I was so nervous, when I was getting it done, but I did it!! My face hurts from smiling so much. This is the first time I have ever done something so technical before on my computer. I'm so happy, I had to stop and do my "happy dance"...Lol!!!
Have a good day.
Mary
Reply
CateR Premium
This video: you add some code that contains a "Tracking ID" to the header.php

The one below: ... you add some (different) alphanumeric to the Google Verification in the SEO

Do they both do the same thing?
Should I insert both?
Reply
Juneyo Premium
The one using the All In One SEO you just have to copy the tracking ID number. Whereas this one is the manual way which you’ve to include the script code and the tracking id as well.

Yes, they both do the same thing. So, just choose one.
Reply
CateR Premium
Okay - something odd there...
"The one using the All In One SEO you just have to copy the tracking ID number."

The Tracking ID is not the same number as the "google site verification" that Marion shows us to paste into the SEO Google Verification spot.

2 different alpha-numerics.
Reply
Juneyo Premium
Pardon me for my ignorance. I just realized you’re talking about 2 different things. I thought the All In One SEO link is talking about verifying Google Analytics with AIO SEO until I click on it.

The answer is yes, you have to do both because they are 2 different platforms. This video is about verifying your GA manually whereas Marion’s video is about verifying Google Webmaster Tools using AIO SEO

Do the GA verification first and then GWT verification.
Reply
CateR Premium
Oh cheers! You are a star.
(I really had no idea WHAT I was taking about!)

May I ask you another one?
Kyle shows us in his video - put the tracking code in header.php under <head> and above php..... mine don't look like that....

In mine, php is right at the top of the page and <head> has some other stuff under it.

So... do I put it "above php" or .... under <head>?
Reply
Juneyo Premium
You should put under <head>. Don’t worry about the stuff under it. Put your cursor at the end of > and click enter once and paste the code.

There is the easiest method using the AIO SEO. Here’s the tutorial.
Reply
CateR Premium
Hi Juneyo,
I put in the Tracker ID and the verification code....into the SEO.
But verification fails when I press "Verify" in Google.
Help?
Reply
CateR Premium
Nevermind question below - I got it to verify!
Thanx for your help! :-))
Reply
devastart Premium
I have a problem! How to cancel a manually entered Google Analytics? I think I enter the Google Analytics code in the wrong place, because when I go on reporting is 0, I think I made a mistake. How to undo entered and where to re-find Google Analytics code that I have to enter. I enter the code under Appearance-editor-theme Header?
Please help
Reply
devastart Premium
I managed to solve the problem. I found in my Analytics tracking ID, and I copy and All In One SEO.
Reply
SandraAngela Premium
Bok, Tanja! Žao mi je, ali na ovo pitanje stvarno ne znam odgovor jer to nisam još radila ni na svojim web stranicama! Kako si ti? Kako napreduješ sa izradom svog sajta? Puno pozdrava!
Sandra
Reply
devastart Premium
Bok Sandra, uspjela sam rješit problem, hvala na pokusaju :). Dobro sam, radim, ne ide baš brzo koliko bi ja htjela i još puno imam za naučit, izrada ide, dok zarade još nema. Nadam se da će se i to promjenit u skorije vrijeme. Pozdrav i cujemo se.
P.S. Nadam se da si to dobro i da tebi ide i izrada i zarada ;)
Reply
meg68 Premium
Thanks to the author of this video Kyle for the great step by step instructions. After having much trouble trying to set up tracking via All in One SEO through Google+, I decided to try doing it manually via Google Analytics. The step by step instructions on this video are great and I'm now set up. The only step I did on my own was adding a filter on GA to exclude my IP address from tracking. I worked that out by Googling for instructions.
Reply