Add Facebook Analytics in Buildbox – Android

Buildbox is one of the fastest growing game engine. With Buildbox creating games is simple and requires no programming skills. One of the drawback of such game engines is that you cant extend or add custom logic in the game logic.

Analytics plays a major role in improving the game play and helps in drawing more players. It also helps in determining many important parameters like retention, ARPU, LTV. I will not go into details of each of these terms.

Let me get to the point and see how we can add Facebook analytics in a Buildbox exported android game. The guide assumes that you have basic understanding of exporting buildbox games. There will be few modifications that are required to add analytics.

  • Open exported project in Android Studio and open build.gradle file. Add this single line inside the dependencies tag and sync project.
  • Open AndroidManifest.xml file and add application id meta tag inside application.

 

  • Add facebook app id in strings.xml file. Replace the string with your facebook app id

 

Add Facebook Analytics Events

You can log game screen enter and exit app events by updating few lines of exported code.

  • Open PTServicesBridge.java file. It is situated in com/secrethq/utils folder.
  • Search screenOnEnter and screenOnExit function to add your app events.

Code Example for tracking screen enter and screen exit events.

Compile and run the code and you will see app events in analytics dashboard. Similarly you can add any analytics like game analytics, appsflyer or firebase analytics in ios buildbox game code. 

Leave a Reply