-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Before anything else you need to setup the Google Analytics Sandbox for storing the metrics of your application. This means:
- Create a new Google Account or make sure you're logged in with an existing one;
- Go to Google Analytics Admin section and define a new Mobile App where the metrics will be stored;
- Wire-up the Google Analytics Reporter in your application using the generated Tracking Id;
- Do a smoke test using the Real-Time feature of Google Analytics;
- Import the Custom Reports from the Google Analytics Gallery for easy metrics reading.
In the Google Analytics Admin Interface create a new Mobile App Property under one of your accounts (or create a new Account to group all your metrics from various apps).
If you're not familiar with this, check this guide.
On the new property make sure you change the session settings to timeout in 1 minute.

Click Apply to save your settings and then go to Tracking Info -> Tracking Code to see the Tracking ID for the property.
You will need this parameter to wire-up the reporter in your application.
![]()
Before wiring it you must first reference it. Easiest way is to use NuGet. Install the Google Analytics Reporter for Metrics.NET package, using the package management UI or from the package management console run:
Install-Package Metrics.Reporters.GoogleAnalyticsNow go to the initialization code in your application, where the Metrics.NET wiring happens and add the following configuration to the Metrics (replacing, of course the "UA-12345678-9" with the Tracking ID that you previously created):
using Metrics.Reporters.GoogleAnalytics;
Metric.Config.WithReporting(cfg => cfg.WithGoogleAnalytics("UA-12345678-9"));Every metric is mapped to a Google Analytics Event.
So, in order to check that everything works fine, you should go to your Google Analytics Dashboard's Reporting Tab, Real-Time -> Events section.
Also, make sure that you're looking at the mobile app reporting that you just set up (in case you have multiple Analytics apps or sites).
If all is well, you should see something like the screenshot below. Keep in mind that, by default, the reporter runs at 10 minute intervals, so you should only see the first data coming in after 10 minutes of running your app.

Please report any issues or improvement ideas as GitHub Issues. For any other kind of talks fell free to buzz me: Twitter (@hinteadan), Facebook (hinteadan), Google+ (+HinteaDanAlexandru), LinkedIn (hinteadan).