Ultimate Guide to Facebook Analytics
Created By: Yash Nagda Last Edited: Mar 05, 2020 4:00 PM
Today marketing is essential part of the app success. Usually businesses use google or facebook ads for the marketing campaigns. But marketing alone is not enough we need a good analytics so we can understand what is working and what is not ?
success doesn't end with an install.
as this quote says we can't measure success by just looking at number of installs. We must know how many users singed up, made purchases etc. So we can fix the bottlenecks and optimise every penny that we are spending on marketing.
What is facebook analytics and app events ?
Facebook provide some very good set of tools for analytics. We can track our app install, sign up and purchase etc. We can also use some specific feature like funnels, target audience to track and optimise our users experience of the app. It is totally free for developer to use and facebook login is not required to use analytics.
How to integrate Facebook analytics in android?
Configure Your Facebook App
- First visit this link and login with you facebook account.
- now give detail of your app and upload key hashes. and follow the process.
Link Your Facebook Ad Account with Your App
- In the app dashboard click Settings > Advanced.
- In Authorized Ad Account IDs, add your Ad Account IDs. You can get your ad account IDs from your Ads Manager.
Integrate the Facebook SDK in Your Android App
We can integrate Facebook analytics in our app in the following steps.
- Firstly, log in to Facebook to create apps or register as a developer.
- Now create a new android project in android studio with api 15 or higher.
- In your build.gradle (Project) file add this.
- Open build.gradle (Module: app) and add following dependency.
- Now open your string.xml file and add following lines.(get the app id from facebook dashboard)
- In your AndroidManifest.xml file add a meta-data element to the application element.
- Also provide internet permission in AndroidManifest.xml file.
- Build your project.
Yay !! You have successfully integrated the facebook analytics SDK. Now you can verify this by opening the app and you will see the event on the console.
Automatic Logged Events
SDK will automatically record following events.
- App Installs
- App Launch
- In-App Purchases
Manually Logged Events
Apart from automatic logged events we can also manually log our custom events in following steps.
- Create object of the AppEventsLogger class.
- Now log the event.
- You can also use two optional parameter in the log event method.
- Bundle - You can add a bundle and add key and value pair in it.
- valueToSum - It is a value which is summed for all the events posted by same user or different user. For example if 10 user by ₹ 10 worth items. Then this value will get summed up to ₹ 100.
- For an example we can log an event of e-commerce app in following way.
In this article we have learned how we can integrate facebook analytics in our android app. We have also learned how we can manually log our custom event to facebook analytics console. I hope you have found this article helpful. If you have any query or suggestions you can post it in the comments below or contact me at firstname.lastname@example.org, I will be really glad to assist you.