find a location for property in a new city

Wednesday 26 October 2011

Remote development and staging environments from Google Analytics

I have created a new site which is currently only getting a low amount of traffic. There is a beta version of the site live at the moment but it is still in development too. My problem is that Google Analytics is still tracking page views on my local machine during development because the Google Analytics tracking code is on the local version too.

I do not want any hits that are a result of me testing my development site or staging site to count towards the total page views and unique visits recorded in Google Analytics. Since there are only low amounts of traffic at the moment my development will dramatically skew the analytics results.

I tried a few ways to control the analytics recordings by using filters in the Google Analytics dashboard but made some mistakes which destroyed all tracking before I finally got it right. Whoops... So to make sure you get it right first time here is how to do it.

How to filter page views from your local or development site

  1. Go to you Google Analytics dashboard by clicking on "Analytics Settings"
  2. Click "Filter Manager »"
  3. Click "Add Filter"
  4. Name the filter
  5. Select the "Custom filter" radio button
  6. Select "Include" radio button
  7. Choose "Hostname" as your Filter Field
  8. And type in "^www\.mysite\.com$" as your Filter Pattern (without the quotes)
  9. Select case-sensitivity. I chose "No"
  10. Add your website profile to the selected website profiles
  11. Click "Save Changes" button
And you're done. This will stop any sites like local.www.mysite.com or 127.1.1.1 every affecting your analytics. It will only register when the host name is exactly www.mysite.com. I hope that helps you get it right first time so you don't accidentally take your analytics down like I did!

Follow britishdev on Twitter

Thursday 20 October 2011

Unable to remove directory. Access to the path 'mswasri.dll' is denied when packaging an Azure project

When trying to build a package using the Azure SDK built into Visual Studio 2010 I sometimes get the error message "Unable to remove directory "bin\Release\CloudPackage.csx\". Access to the path 'mswasri.dll' is denied."

This stopped me from being able to build Azure cloud package ready for deployment. I tried changing my cloud package .csx file to read only but it just changed back. I tried deleting it but it was in use.

This gave me a clue. I run my local copy of my Azure site through my local IIS. I think this was locking the site and thus preventing it from being packaged.

Solution

The way to solve this problem that I found to work best was to find the Application Pool that is running the web application in my local development environment and stop it. This allows me to successfully package my web application ready from deployment to the Azure cloud!

Follow britishdev on Twitter