Android Google Firebase Analytics

 

Android Google Analytics :

Android Google Analytics, Hi, everyone we go through a lot of apps and websites these days, they may be related to different domains, may be no way related to each other but every website or app deals with a important topic called as “analytics”.

Today we are dealing with google analytics android tutorial, Yes this may not be a new word for few but in this google analytics android tutorial i am targeting who are new to this terminology. 

 

Analytics :

Analytics is the phenomena where the statistics of the app or website is closely observed so that the audience, their interest can be noticed by the app respective admins.

So here lies the point that analytics not only helps to know the audience count but also improves the overall performance of app/website in terms  of tracking bugs in time as well getting notified with reviews, and few more which may help development.

 

Much More Simple :

So now have you ever noticed popular website like Flipkart, Amazon, snapdeal, and many more shopping portals and their apps starts showing you products which you have stared at, purchased, or looking for  lot once you visited them.

Now, i think you understood now that by this simple example its a part of analytics and also its not that simple as it appears but lets see it in our coming tutorial.

 

Android Google Analytics Is this for everyone ?

When you are trying to build an app/website, ok think its done and now you want to know  who visited them and what have they been going through, how much time they are spending on your site exactly on which page this is what we are going to deal with.

Also from where i.e, country, device, service provider, gender, number of visits per hour,  day, week, monthly like what not you can know all these scenarios and much more google analytics android tutorial.

 

 

Let’s Get started :

Are you planning to start developing a new app or already having an app so this android app development tutorial is very much useful for you, lets get started today we will deal with a simple example on Android Google Analytics by which we can trace out analytics of our app.

We will be using Google Firebase for tracing out app’s analytics.

 

 

Visit https://firebase.google.com to get started with Android Google Analytics

Then login in with your credentials

 

 

 

 

 

 

Then Add a project

 

Select Android Project

Android Google Analytics

 

Add Firebase to your android app by mentioning package name, app name, and SHA-1.

 

Android Google Analytics

 

 

The process of retrieving SHA-1 key is shown below

Android Google Analytics

 

 

 

 

Download the json file and add it to your android studio project.

Then add dependencies for Android Google Analytics

 

build.gradle (Project: Firebase Tutorial)

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
    classpath 'com.google.gms:google-services:3.0.0'
}

 

build.gradle (Module: app)

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5'
    testCompile 'junit:junit:4.12'
    apply plugin: 'com.google.gms.google-services'
}

 

 

In MainActivity add FirebaseAnalytics as

private FirebaseAnalytics firebaseAnalytics;

 

Then initialize Android Google Analytics

firebaseAnalytics = FirebaseAnalytics.getInstance(this);

 

Add a log event

firebaseAnalytics.logEvent("MainActivity", new Bundle());

 

Don’t forget to add internet permission to your manifest file

<uses-permission android:name="android.permission.INTERNET" />

 

 

Android Google Analytics

 

And that’s it now after 24 hours you will be able to track your audience

 

Try it out and ask me below in comment section if you have any queries.

If you require project file and having any other query’s on Android Google Analytics do let us know in the comment section below.

Share it to your friends if you really like it for more interesting tutorials.

Show Buttons
Hide Buttons
Read previous post:
Android Marshmallow Permissions | Requesting Run-Time Permissions

Introduction Now a days you can notice permissions popping up in android marshmallow phones (ver 6.0 android) when you deny permission...

Close