From the course: Visual Studio App Center for Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add custom analytics

Add custom analytics - Visual Studio Tutorial

From the course: Visual Studio App Center for Developers

Start my 1-month free trial

Add custom analytics

In order to know if our app is meeting business objectives or needs to be changed, or even improved, it is important to be able to tell how users are using our app. Visual Studio App Center provides this by adding custom analytics. Since we already have added the libraries for this, we can now add code to allow it directly in our app. Let's look at a scenario where we want to know any time a user taps on an item in our app, and if they do, what item was selected. To record this, we're going to use the Items page that we used for our last crash test. At the top of the file, we're going to add a using statement. So here we're going to say, using_Microsoft.AppCenter.Analytics; and then we'll scroll down to the OnItemSelected, we're going to remove the InvalidCastException, un-comment out the code, and before we push a sync, we're going to add a call to Analytics.TrackEvent and the first parameter is the name of the event we want to track. And we're just going to say "Item Selected". And…

Contents