Month: October 2013

Run Analytics on your Windows Azure WebSite – Part I

Web Analytics is basically measuring and collecting information about your Web Site usage  that helps you understand

  •  user/customer behavior
  • track traffic to your website
  • analyze marketing campaigns and conversion rates

There are many Open source applications that  give you a great view to your website usage through reports of various kinds of information about your WebSite .  Here are two apps that are popular  : Piwik and Open Web Analytics .

In part I of this tutorial you will learn how to set up your Piwik application .  In part II of the tutorial you will learn  the steps required to  setup your web site to allow the Piwik application to collect the data.

How to setup Piwik application

Piwik is available on github : https://github.com/piwik/piwik . You can create a fork of the application if your have a github account or download the application in a ZIP format .

Once you have the content for Piwik application  , the next step is to log in to the Azure Management Portal and create a new website with a MySQL database as shown here

  • Select New –> WebSite  –> Custom Create
  • Enter the site name , select a region and  select  ” Create new MySQL database”

Capture7

customcreate

Using GIT , you can publish Piwik to this newly created Windows Azure website  . You can refer this article on how to publish from github or  local GIT repository.

Once PIWIK application content in published to your azure website , click on browse and PIWIK Web Installer will show up .  Before we continue with the PIWIK installer , keep a note of the connection string for the MySQL database as this will be needed .

connectionstring

Now complete the steps as shown below :

piwik1

piwik2

Enter the database information

piwik5

piwik4

Enter the site admin username and password

piwik5

Enter the site name , url and timezone  against which you wish to collect web analytic  data .

piwik6

piwik7

Keep a note of the script mention in the above screenshot . This script needs to embedded in every web page  in order for PIWIK application to start collecting data .

piwik8

That’s it , Piwik is now configured . Lets see the next steps to get you website integrated with Piwik in Part II of this tutorial .

Advertisements

Run Analytics on your Windows Azure Website – Part II

Setup your existing WebSite to allow Piwik Application to collect data

Every web page must includes the JS code required for Piwik  as seen below :

<!– Piwik –> <script type=”text/javascript”> var _paq = _paq || []; (function(){ var u=((“https:” == document.location.protocol) ? “https://{$PIWIK_URL}/” : “http://{$PIWIK_URL}/”); _paq.push([‘setSiteId’, {$IDSITE}]); _paq.push([‘setTrackerUrl’, u+’piwik.php’]); _paq.push([‘trackPageView’]); _paq.push([‘enableLinkTracking’]); var d=document, g=d.createElement(‘script’), s=d.getElementsByTagName(‘script’)[0]; g.type=’text/javascript’; g.defer=true; g.async=true; g.src=u+’piwik.js’; s.parentNode.insertBefore(g,s); })(); </script> <!– End Piwik Code –>

You can learn more about this Javascript code in this article  . Piwik allows you to

  • track multiple websites
  • access to multiple users
  • install third party plugins

This is all it takes to set up Piwik for your website .   To view your website usage  data, login to Piwik site you created on Windows Azure Websites .

Bottle Python Framework now on Windows Azure Websites

Bottle is a fast, simple and lightweight WSGI micro web-framework for Python.  This tutorial shows you how to create a website on Azure for Bottle Framework in just a few clicks.  You require a Windows Azure account to begin.Once you are logged into the Management portal, you will need to create a new site “from gallery” as shown below

Capture7

Choose “App Frameworks” category and then select Bottle . Click on Next

bottle1

Continue reading “Bottle Python Framework now on Windows Azure Websites”