So you’ve built your very first Windows 8 Store app, had it approved and it is now available in the Windows App Store. The only thing is, you will have to be patient to see if people are downloading and using your app. Since the Store dashboard only updates your apps download stats once a day, it can be a highly frustrating wait. But the reality is that you don’t need to wait. By implementing Google Analytics within your app, you can see instantly how many people are using your app, track their interaction and find out where they are using your app from.

Using Google Analytics in your Windows Store app is quite straight forward. There are a number of free libraries that allow you to do this in minutes. I tried out a few of such libraries and settled on one – for me, the best was Google Analytics SDK for Windows 8 and Windows Phone.

Here’s how you can implement this within your Windows 8 or Phone XAML project (for JavaScript solution, for this guide).

1. Create your Google Analytics Account

ga_setup.png

2. Make sure you select “App” and not “Website”

3. In your app manifest, add the “Internet” capability under the “Capabilities” tab.

4. Install the Google Analytics SDK via Nuget

nuget1.png

nuget2.png

5. Modify the analytics.xml file that is automatically added to your project after installing the SDK.

6. You should change the tracking-id, the appName and appVersion values.
Obviously the tracking-id should be that of the account created in Google Analytics.

<?xml version=”1.0″ encoding=”utf-8″ ?>
<analytics xmlns=”http://googleanalyticssdk.codeplex.com/ns/easytracker”>
<!–Replace placeholder ID with your tracking ID–>
<trackingId>UA-XXXX-Y</trackingId>
<!–Replace placeholder name with your app name–>
<appName>TestApp</appName>
<!–Replace placeholder version with your app version–>
<appVersion>1.0.0.0</appVersion>
</analytics>

7. Add the tracking code to your porject…

// track the page view
GoogleAnalytics.EasyTracker.GetTracker().SendView(“main”);

// track a custom event
GoogleAnalytics.EasyTracker.GetTracker().SendEvent(“test”, “userclick”, null, 0);

Once you build and test your app, you should instantly see statistics being tracked in the “Real-Time” section of your Google Analytics.

Happy tracking!

 

Be Sociable, Share!