Monday 27 June 2016

Setup - Google Analytics - Tracking metrics & statics


Set up Analytics tracking
==========================


Learn how to set up tracking for websites, apps, or other devices.
Find your tracking ID or tracking code snippet

To set up Google Analytics tracking, you’ll usually need either your Analytics tracking ID or the entire Javascript tracking code snippet. This corresponds to your Analytics property. To find the tracking ID and code snippet:

     step1: Sign in to your Analytics account. url ->https://analytics.google.com  user id -> ganapathi@gmail.com
     step2: Select the Admin tab.
     step3: Select an account from the drop-down menu in the ACCOUNT column.
     step4: Select a property from the drop-down menu in the PROPERTY column.
     step5: Under PROPERTY, click Tracking Info > Tracking Code.

e-g

<script>
  (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.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

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

</script>


Analytics ID is UA-76621271-1.It's unique for every account.


 set up tracking:

Static website
Dynamic website
SPA (Ecom) Website
Web-hosting service (you don’t manage source code)
Website using Google Tag Manager
Mobile apps (Android, iOS)
Internet-connected device


Static website
===============


A static website is one in which the page HTML is NOT generated using a programming language or interface such Python, Ruby, PHP, etc. To collect data, you must copy and paste the Analytics tracking code into the source code on every web page you wish to track.

    Once you have the Javascript tracking code snippet for your property, copy the snippet exactly without editing it.
    Paste your tracking code snippet (unaltered, in its entirety) before the closing </head> tag on every web page on your site you wish to track.


Dynamic website
=============
==

A dynamic website is one in which the HTML is generated using a programming language such as Python, Ruby, PHP, etc. To collect data, you must include the Analytics tracking code in the source code on every web page you wish to track. You can use a common include or template to push the tracking code dynamically into every page.

    Once you have the Javascript tracking code snippet for your property, copy the snippet exactly without editing it.
    Paste your tracking code snippet into its own include file, then include it in your page header, so that the snippet appears before the closing </head> tag on every web page on your site you wish to track.
eg php site------>

<?php include_once("analyticstracking.php") ?>

Single Page Application Dynamic website - Ecom
===============================================

Once you have the Javascript tracking code snippet for your property, copy the snippet exactly without editing it.
    Paste your tracking code snippet (unaltered, in its entirety) before the closing </head> tag on every web page on your site you wish to track in index.html. It will work on All over the web sites.


GTM Setup and installation
===========================

To get started managing your tags using Google Tag Manager:

    Go to tagmanager.google.com to create a Google Tag Manager account (or to access an existing account ganapathi@gmail.com).
    Create a container for your site or app.
    For websites: Add the container snippet to your site while removing any existing tags.
    For mobile apps: Implementation of Tag Manager for mobile apps is done in conjunction with the Firebase SDK. See the Android or iOS documentation for more information.



GTM - Creating an account and container
----------------------------------------


    From the Home/All Accounts page in Google Tag Manager, click Create Account. (You can always get to this screen by clicking on the Tag Manager icon in the far upper left corner of the screen.)
    Enter an account name, optionally select the checkboxes to enable sharing data anonymously with Google and others and click Continue.
    Enter a container name when prompted in the Setup Container dialog. Select the container for Web, iOS, or Android. If setting up a mobile container, select whether you're using the Firebase SDK or one of the legacy SDKs. Click Create.
    Review the Terms of Service and click Yes if you agree to those terms.
    When your new container first loads, you will be prompted with the web container installation code snippet, or to get started with Tag Manager as part of the SDK for your chosen mobile platform. Click OK to clear this dialog (you can always set up your container first and install the container snippet or SDK later.)

GTM - Adding the container to web pages (UA tracking code is reduntant- use any once GA or GTM tracking code)
=============================================================================================================
Near the top of your container's home screen, you will see your container ID number (formatted as "GTM-XXXXX"). Click it to launch the Install Google Tag Manager box.
Copy and paste the code snippet into your website. Paste this code so that it appears immediately after the opening <body> tag on every page on your site. 



eg
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-NF7CSX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-NF7CSX');</script>
<!-- End Google Tag Manager -->



At this point, you’ve set up your account and installed the tracking code on every
page of your web site so that Analytics can start gathering data on your site. After
just 24 hours, you’ll be able to login to your Analytics account in AdWords and see
results about your visitors!

No comments:

Post a Comment