Introduction

I have always been interested in learning which features of my application users are using as well as if they are using it.  I have done this with other applications by using my own “home-grown” version of web services, etc. Since I have been working a lot with Windows Phone 7 lately, I decided to learn how to do this and share with the community. Before you get started you will be pleased to know that you won’t have to spend any money *at least until 2012* to do this with your existing phone apps.

To Get Started:  

Download Dotfuscator at http://www.preemptive.com/windowsphone7.html. After it is downloaded you will want to add your WP7 .XAP file to Dotfuscator. This will allow you to setup analytics and obfuscation of your application.

1.png

After it is loaded then you will want to click on the Input tab and take a look at the .DLL’s referenced in your project.  You will want to exclude any third party dll’s from the package. Don’t worry as they are not excluded entirely. The only thing you want left in here is your main application .dll and the Package Artifacts. So in the example below, I removed the Telerik 3rd party controls and only left my michaelcrump.net.dll and Package Artifacts. 

2.png

You will now want to click on Settings and look for Instrumentation. Make sure that the first three are set to Yes.  

3.png

Now we are going to click on the Instrumentation Tab and right click our main application .dll and add an attribute. 

4.png

Select “PreEmptive.Attributes.Application.Attribute”. 

5.png

You should have this screen now. This allows you to setup the Application Type and give it a name that you can see in your Preemptive Solution Dashboard. Go ahead and fill in your applications info. You can uniquely generate a GUID by clicking on the ellipse button in the right hand corner box. 

6.png

Once that is complete you are going to want to add a BusinessAttribute. So right click again and select BusinessAttribute. 

7.png

At this point, you will want to fill in your company name as well as the CompanyKey that was provided in an email from Preemptive Solutions. 

8.png

Now that we have included our Application and Business information to our project. We will need to setup our SetupAttribute and TearDown Attribute. 

Starting with the SetupAttribute:

Navigate inside your Application until you get to App –> Then InitializeComponent: void(). Right click on this field and add a SetupAttribute. You will want to make sure the Custom EndPoint is set to wp7data.runtimeintelligence.com/PreEmptive.Web.Services.Messaging/MessagingServiceV2.asmx. This is a selectable option, so you will not have to type it. This is basically a web service that will collect data as your users click on different items in your application.

9.png 

Now the TeardownAttribute:

Navigate inside your Application until you get to App –> Then Application_Closing event. Right click on this field and add a TearDownAttribute. You can leave all the options on this page as the default. 

10.png

Now comes the fun part, adding Attributes to the features you want to track. 

So for example: In my application I have four buttons on the main page. I have added the following attributes to track when a user clicks on each of them.

So right click on your click event and add a FeatureAttribute. In the example below you will see that I added 4 FeatureAttributes to my project. 

11.png

You should name them where you can easily find them in the Preemptive Dashboard (screenshots coming up). For example on my AboutButton, I named it AboutButtonClicked. 

12.png

Now all you will need to do is hit the Run Button and your application will recompile with the necessary files/references needed to communicate with Preemptive’s webservice.

After you run your application a few times you can go and check your results by going to the portal site at: http://wp7.runtimeintelligence.com/portal/Security/Logon

This will give you a snapshot of your application and queued data. You can drill in to see more info. 

13.png

I drilled into michaelcrump.net and found exactly how many times users were clicking on my button. This new version of my app had only been out a few days and I quickly realized that most people use my RssFeed button than any other feature of my app. This is valuable information as it could tell you what features to drop or which ones you should improve on. 

14.png

You also get a nice little graph at the bottom of the dashboard that tells what locations your users are in. You can hover over each one more more stats.  

15.png

What was very interesting to me was during application certification, I could see the location of the testers. This was very cool to see.

Conclusion:   

Overall I’m very impressed with the services that Preemptive Solution provided. From everything that I gathered this service was going to be free until January 2012. If you decide not to pay then you won’t have to resubmit your application. It will still work, you just won’t have any access to the data it provides. 

Thanks for reading and please subscribe to my blog or follow me on twitter. 

alt Subscribe to my feed

推荐.NET配套的通用数据层ORM框架:CYQ.Data 通用数据层框架
新浪微博粉丝精灵,刷粉丝、刷评论、刷转发、企业商家微博营销必备工具"