How to get and use Google Analytics tracking code?

How to  use Google Analytics tracking code in WordPress?
First you need to Create Google Analytics account.
You’ll need to create a new profile in your Google Analytics account, then you can use free Google Analytics tool.
You can also login with your gmail account (if you already have one) into Google Analytics Official Website and get your website’s tracking ID and embed the code into your website’s header.
To do so login Google Analytics account, in the Admin page click on Create/Edit/Delete Profile

To create a profile:

Click + New Profile.
Enter the general information (Name, country/territory, time zone).
Click Create Profile.
Select that new profile from the Profile Settings menu and copy the Profile I.D

All WordPress themes has header.php page. You can put the into your header and Google can track your website visitors.

< script type=”text/javascript” >

var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXX-X’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);

< /script >

Once you find the code snippet, copy and paste it into your web page, just before the closing < /head> tag.

Adding Google Analytic tracking code manually:

  1. Login to your WordPress website admin panel
  2. Goto Appearance > Editor (theme editor)
  3. Select the header.php or index.php
  4. Find the html tag ; < head> < /head>
  5. Copy and page the Google Analytics code after the < head> tag, before the < /head> tag.
  6. Then click Update File to save changes.

Whatever WordPress theme you use, there is always a header.php page.
You can find header.php page under theme folder.

There you could include the Analytics tracking code in the header.php file like this:
< !DOCTYPE html >
< !– This is the header file for the site — >
< html >
< head >
< meta http-equiv=”content-type” content=”text/html; charset=utf-8″ >
Your website title

Click the image to see how to add the code below:

tracking code
tracking code

If this is too complicated for you, then might use a plugin to do the job, such as;
google-analyticator WordPress plugin

When you use Google Analytics you will be able to track all your site visitors moves. You can see at Google Analytics website dashboard:

Which site they came from to arrive at your site
Which country and state they come from
Which browser they use to view your site
Where they went when they left your site
Which links they clicked on your site
How long they stayed on your site
Which pages they viewed on your site
What keywords they used to find your content
What time they viewed your site

detail visitor report
detail visitor report

Google Web Analytics & Reporting 
Analytics lets you measure your advertising ROI as well as track your Flash, video, and social networking sites and applications. Google Analytics Official Website