[Google Analytics Plugin] Google Analytics Plugin Documentation

[Google Analytics Plugin] Google Analytics Plugin Documentation

  
Forge Component
(5)
Published on 26 Oct by OutSystems Experts
5 votes
Published on 26 Oct by OutSystems Experts

How to use Google Analytics

What is Google Analytics

Google Analytics  is a cloud service able to provide mobile analytics and crash reporting, showing the data in dashboards. If you already know what Google Analytics is you can skip this to Google Analytics Setup.

Features

Whether you want to boost sales or find more users, Google Analytics helps you to improve your business across your sites and apps. 

Data Analysis, Visualization, and Reporting

Reports can be segmented and filtered to reflect the needs of your business. Access an array of reporting and analysis tools that help you understand your customers from acquisition to purchase.



Offline Mode

When there’s no connectivity, gathered metrics are cached and sent when the Application is launched with an active network connection.


If you want to know more about Google Analytics, and all the available features you can access their website here.  

Google Analytics Setup

How to create an account

Create a new Google account if you do not have one. Visit google.com/analytics, click the “Sign in” button (top right).


You need to click on “Sign up” button in the following screen:



After signing up you have to select the “Mobile app” separator and choose a name to your account and application.

How to get Tracking ID

To be able to use the Google Analytics Plugin on your mobile application, you will need to get the “Tracking ID” of your application.

  1. Access administration page;
  2. Select “Tracking Code” in the menu;
  3. The “Tracking ID” will be available on this screen.



This “Tracking ID” can be used in any application, so be careful not to mix data from other applications.

What can you do with Google Analytics Plugin

When the Google Analytics Plugin is integrated in your Outsystems Application, by default you are able to see: native crashes (when enabled), real-time data about active usersnumber of sessionsmost used application versionsmost used operating systemsmost used devices and user location

It is also possible to refine this information using Google Analytics Plugin actions. You’ll be able to track: crashes with additional informationviews, screens, timings and custom metrics and dimensions

Google Analytics Plugin Actions


The following actions are available on the Google Analytics Plugin:



GoogleAnalytics.PNG


For more detailed information about each action, you can find their descriptions and input params on the Plugin itself.


In the section  Some integration use cases”, you can learn how to implement three use cases using some of actions listed above:

  • Keep track of all errors and exceptions using “TrackException” action;
  • Keep track of visited screens using “TrackScreen”;
  • Keep track of the number of banking transfers done on my home banking app using “TrackEvent” action.


How to use the Google Analytics Plugin

Installation

Start by installing the Google Analytics Plugin from OutSystems Forge. The fastest way to do this is to go to the OutSystems tab in your development environment and install from there.

Add the Plugin to your Outsystems Application

On your application, use “Manage Dependencies…” to add a reference to the Google Analytics Plugin.


To use the Google Analytics Plugin actions, drag and drop the “Client Action” to your screen and choose one of the Google Analytics Plugin actions that you want to use on your Outsystem application.


Initialization

Before you can send data to Google Analytics, you need to initialize the Google Analytics Plugin:

  1. Go to “Logic” tab in the Development Environment;
  2. Right click on “Client Actions” folder;
  3. Choose “Add System Event”;
  4. Click on “On Application Ready”


  


Then, add the “StartTrackerWithId” Google Analytics Plugin action.


Set the “Id” parameter to the “Tracking Id” of your application.


Enable Uncaught Exception Reporting

By default, your Outsystems application doesn’t send any data to Google Analytics about uncaught native crashes. To start sending this information, add the “EnableUncaughtExceptionReporting” action to the “On Application Ready” event, after the cal to “StartTrackerWithId”.


Then, set the “Enable” parameter to “True”:


Some integration use cases

Track Crashes

It is possible to track all the exceptions that can occur in your actions. To do that, use the “TrackException” Google Analytics Plugin action. 


As action inputs, you need to indicate if is a fatal exception and the exception description content:



Now let’s see the data in Google Analytics website. Click on “Crashes and Exceptions” under “Behavior” tab, and you will be able to see the crashes of your application.


Track Screens

In order to track information about the screens, you need to call the TrackScreen action. This can be done either on the “onReady” event on each screen you want to track or, if you want to track all screens, you can place it on the “onReady” event of the “Layout” block.

As input to this Google Analytics Plugin action, you have an optional parameter where you can insert the name of the screen you want to track. If you don't insert any custom name, it will automatically track with the name of your OutSystems screen.



Now let’s see the data in Google Analytics website. Click on “Screens” under “Behavior” tab, and you will be able to see the Screen Views of your application.


Track Event

Let's say you have a mobile home banking application, and you want to know which types of bank transfers your users use the most.


Assuming you have a “Transfer” action flow like this: 

You can track the transfer event by using the “TrackEvent” Google Analytics action in your “Transfer” action.


Next, you need to fill the inputs of the Google Analytics Plugin action. Both “Category” and “Action” are mandatory parameters and you can use them to track the transfer type.



Now, assign the “Category” parameter with “Transfer” and the “Action” parameter with “Internal”. You can also use the Label and Value to specify the transfer amount.


Capture.PNG


In the end the “Transfer” action should be similar to this:



Now let’s see the data in Google Analytics website. Click on the “Behavior” tab, and choose “Events”.



In the “Overview” dashboard you can conclude that 178 transfers were made with your application. From those 178 transfers, 92 were “External” and 86 were “Internal”.