Embedding Google Analytics in your VizMap application

What can you learn here ?
  • create analytics profile
  • add your account
  • track your usage

javaScript: embedding Google Analytics get it now

This relates to Data Driven Mapping applications and the javaScript 'howTo' section.

How embed Google Analytics

You may want to embed google analytics in your generated application. Since the application  is generated from Excel, you need to embed the code in your workbook in the geoCodingParameters worksheet.  You will find the code at the end of the mcpherfunctions section.


Once you have a Google Analytics account, you can add a new profile for tracking. If you do not know how to this, there is an article on this site explaining how to setup up a profile for Google Analytics. When you go through this process, you will have a specific account number you can track usage against. Find the following piece of code in the mcpherfunctions parameter code and change the account code to your own.

<script type="text/javascript">

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

Your analytics report will show each VizMap application separately under content as follows



Comments