Google Analytics provides powerful tracking
for anyone with a web presence, large or small. It is a service offered by
Google that generates detailed statistics about the visits to a website.
It is free and great dashboard and self understood tool.
This is the link of Google Analytics website http://www.google.com/analytics/
You can use your own Gmail account or make a new account for
Google analytics.
How to configure your website in admin tool?
- Go to admin and make a new property.
- You just have to add your website link and Google Analytics will provide you the
script with Google tracking ID which is unique. You just have to put the Google
Analytics code in your master file. I am working in MVC, So I added that in
layout.cshtml
<script
type="text/javascript">
var
_gaq = _gaq || [];
_gaq.push(['_setAccount', 'Google Tracking Id']);
_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>
After 24 Hours of time your website Info will start getting tracked by Google Analytics.
Code implementation for Event Tracking?
Now If you want to track particular event like click of button, Slider change
then you have to write few lines of code.
In your JavaScript file you just have to write the below code
$('.ClassName').click(function () {
_gaq.push(['_trackEvent', 'Category', 'Action, 'label']);
});
Category and Action is mandatory and label is optional.
You can send value in Category like Calculator Name ("HomeLoan Calculator") and
in Action "Slider Used" and in Label you can send the value.