Introduction
This article helps to
track your website pages and internal links with the help of Google
Analytics. Google Analytics is used to track a website. We can
get the following reports by configuring our site with
Google Analytics.
- How many people
visited our site daily.
- Where they are going
from our site.
i.e, Tracking internal
links of the page and click counts.
- Area wise
reports.....etc. still we can get different type of reports using Google
Analytic.
Background
Steps to configure your website with Google Analytics.
- Create
a Gail Account .
- Sign in here http://www.google.com/analytics/
- After log
in, click on Sign Up button displayed at ringside of
the page.
- Now a form
get displayed. Here provide your website name, your
website URL ,Account Name other details.
- Finally click on Get
Track ID button and then click on i accept button.Now
some java-script code will be displayed, which looks like
as bellow script
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Using the Code
You just copy above
generated script and paste on the page you want track. For
example if you want to track 3 pages in your website then you have to paste
this script on three pages.
You have to paste the
script just above the end of body tag.
<html>
<body>
-------your design------
-----Here paste above generated the script--------
</body>
</html>
The above stuff
is for tracking your page.i.e We can get no.of people visited our page.
Steps to track outbound links in a page with Google
Analytics.
The links
that redirects from our page to any other page are called as outbound
links.If you want to track links with in the page then you have to fallow 2
steps..
- Paste the below script
within the
<head>
tag
<script type="text/javascript">
function trackOutboundLink(link, category, action) {
try {
_gaq.push(['_trackEvent', category, action]);
} catch (err) { }
setTimeout(function() {
document.location.href = link.href;
}, 100);
}
</script>
- Call the function
trackOutboundLink()
from each and every link available in your
page
E.g.: Suppose your link is like
<a href="http://www.abcd.com" ></a>
You just modify above link by adding a onclick event
<a href="http://www.abcd.com" onclick="trackOutboundLink(this,
'Outbound Links', 'http://www.abcd.com'); return false;"> </a>
Note:
- Now you can watch all the reports by log in in to your account.
Sign in here: http://www.google.com/analytics/.
- You can't see reports immediately in Google analytics. It will take 24 hours to display all type of reports.