Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

10. Advanced Tracking Techniques > Pulling It All Together

Pulling It All Together

So now, let’s look at our business question and the data model we’re going to use to answer it:

Business question we want to answer: Which view type do visitors use most?
Event category: Map
Event actions: View Change
Event labels & values: Satellite = 10, Satellite with Labels = 15, Map = 5, Terrain = 0

Implementation

Now let’s take the data we defined in the previous section and turn it into code.

Step 1: Tag your pages

I know this seems simple, but the first step is to make sure you tag your pages with the Google Analytics tracking code:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXX-YY']);
  _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>

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint