Skip to content

Getting Started

Hintea Dan Alexandru edited this page Apr 10, 2016 · 11 revisions

Getting Started with Google Analytics Reporting

Before anything else you need to setup the Google Analytics Sandbox for storing the metrics of your application. This means:

Create the Mobile App on Google Analytics

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.

Google Analytics Mobile App Session Settings

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.

Google Analytics Mobile App Tracking ID

Wire-up the reporter in your app

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.GoogleAnalytics

Now 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"));

Smoke Test the Data Reporting

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.

Google Analytics Reporting Smoke Test Screenshot