ZEND PHP certified Engineer, Sr. web developer at
Mindfire Solutions. Expert in WordPress and Drupal.
Mail: firstname.lastname@example.org/ email@example.com
What is Google Analytics
service offered by Google
most widely used website statistics service
statistics and reports about visitors on a
website at-a-glance dashboard view as well as detailed
What it does
Daily, monthly, yearly tracking of site visits
Create Graph over time
Which pages visitor went to, how long they stay
Bounce rate is the percentage of visits that go only one page before
exiting a site.
How they came there
Search engines and Search terms used
Location, operating system, monitor resolution
Over 80 reports available
How to setup GA
Sign up to Google Analytics and provide site link
- They return code to you
- Paste the code just before the </body>(end body) tag
- Put it on EVERY page you want to be track by Google
- Put it in your template pages, so it will be
automatically on every page
- Go to the Analytics dashboard page to see daily
Sample Analytic Code
var _gaq = _gaq || ;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') +
var s = document.getElementsByTagName('script');
Type of COOKIES
First-party cookies are created by the Web site you are visiting
and are necessary to keep track of your personal preferences
and the current session as explained above.
Third-party cookies are created by a Web site other than the
one you are currently visiting; for example, by a third-party
advertiser on that site. The purpose of such cookies is usually to
track your surfing habits, which is why third-party cookies are
considered an invasion of privacy and riskier than first-party
Type of COOKIES (contd...)
persistent and temporary cookies:
Persistent cookies: these cookies come with an expiration date set somewhere
in the future. They remain on a computer's hard drive until they expire or are
deleted by the user.
Temporary cookies : these cookies are much shorter-lived than their persistent
brothers; they expire as soon as the user closes the browser.
Domain Hash: This unique number represents the domain which set up the cookies.
All Google Analytics cookies set by a particular domain have same domain hash. This
number is independent of browser and device.
Random Unique ID: This is the randomly generated number.
Next three numbers are unix timestamps which are represent the time of initial visit,
beginning of previous session and beginning of current session respectively.
The last number is the session counter. It is incremented by one each time a visitor
starts a new session.
__utmb & __utmc
__utmb & __utmc - work together as Session Identifiers.
__utmb - a persistent cookie which expires after 30
minutes. Contains domain hash and additional values.
__utmc - a temporary cookie deleted when the user
closes the browser. Contains only the domain hash.
Why does Google use both?
If a web page is open for 30 minutes without
activity, the _utmb cookie expires but the _utmc
cookie remains. The next time the user lands on
the page, a new _utmb cookie is created,
denoting a new session but a returning visitor.
With each new page a visitor lands on, the _utmb
cookie gets refreshed, so sessions can last as long
as the user keeps moving throughout the site
without hitting the 30-minute 'inactivity'
__utmz - this is the Campaign Cookie. Stores campaign tracking values passed
by tagged campaign URLs, including utm source, medium and campaign.
Pageview vs Visits
A pageview is can be defined as a view of a page on any site that is being tracked by the
GA tracking code. If a visitor reload after reaching the page, this will be counted as an
another pageview. If a visitor navigates to a different page and again returns to the first
page pageview count will be increase as well.
Visits represent the number of identical sessions initiated by all the visitors to a particular
site. If a user is inactive on your site for more than 30 minutes, then this visitor's next
activity to the site will be count as a new session means new new visits.