Click here to Skip to main content
Click here to Skip to main content

Adding Analytics to your Windows Phone 7 App with Preemptive Solutions

, 22 Mar 2011
Rate this:
Please Sign up or sign in to vote.
Easy way to add Analytics to your Windows Phone 7 App with Preemptive Solutions

Editorial Note

This article appears in the Third Party Products and Tools section. Articles in this section are for the members only and must not be used to promote or advertise products in any way, shape or form. Please report any spam or advertising.

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, you will want to click on the Input tab and take a look at the .DLLs referenced in your project.  You will want to exclude any third party DLLs 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 for 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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

mbcrump
Software Developer (Senior) Telerik
United States United States
Michael Crump is a Silverlight MVP and MCPD that has been involved with computers in one way or another for as long as he can remember, but started professionally in 2002. After spending years working as a systems administrator/tech support analyst, Michael branched out and started developing internal utilities that automated repetitive tasks and freed up full-time employees. From there, he was offered a job working at McKesson corporation and has been working with some form of .NET and VB/C# since 2003.
 
He has worked at Fortune 500 companies where he gained experience in embedded systems design and software development to systems administration and database programming, and everything in between.
 
His primary focus right now is developing healthcare software solutions using Microsoft .NET technologies. He prefers building infrastructure components, reusable shared libraries and helping companies define, develop and automate process standards and guidelines.
 
You can read his blog at: MichaelCrump.net or follow him on Twitter at @mbcrump.
Follow on   Twitter

Comments and Discussions

 
GeneralMy vote of 5 PinmemberAndy Pierrepoint25-Oct-11 3:03 
GeneralMy vote of 5 PinmvpKunal_Chowdhury22-Mar-11 8:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 22 Mar 2011
Article Copyright 2011 by mbcrump
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid