AdMob+Firebase 101 Unity: Setup & Analytics Basics

1. Introduction

Ads are a crucial part of your app's overall user experience. Good ad implementations can help improve your overall app experience and even improve user retention and engagement. For example, Rewarded ads enable you to reward users with in-app currency or items for watching video ads, so that users can reach new heights where otherwise they may get stuck and would have churned.

However, making an excellent ads experience isn't easy. You may have questions like: How often should you show these ads? Where and when should you show them? What should the award be? Unfortunately, the answer differs from app to app and from placement to placement. There is no one-size-fits-all answer.

With Google Analytics for Firebase, AdMob, and several other powerful yet easy-to-use tools that Firebase offers, fine tuning your app in a data driven way has become much easier and more streamlined. Today, we'll be showing you how you can get started!

What you'll build

This codelab is the first of three codelabs that will guide you through building an app called Awesome Drawing Quiz, a game that lets players guess the name of the drawing. It will demonstrate how you can incorporate Rewarded Ads and Firebase services in your game.

In this codelab, you'll integrate Google Analytics for Firebase to record some important app events. Also, you'll learn how to read the app analytics shown in the Firebase console.

What you'll learn

  • How to setup Google Analytics for Firebase in your app
  • How to record the app events
  • How to read the app analytics shown in the Firebase console

What you'll need

  • Unity 2018.4.4f1 or higher
  • Xcode 10 or higher (to build the target for the iOS)
  • A Google account
  • A test device with Android 5.0+ with a USB cable to connect your device, or an Android Emulator running AVD(Android Virtual Device) with a system image that supports Play Store/Google APIs
  • An iOS device or a simulator running iOS 8.0 or higher

How would you rate your level of experience with AdMob?

Novice Intermediate Proficient

How would you rate your level of experience with Firebase?

Novice Intermediate Proficient

2. Setup development environment

Download the code

Click the following button to download all the code for this codelab:

Unpack the downloaded zip file. This will unpack a root folder named admob-firebase-codelabs-unity-master.

...or clone the GitHub repository from the command line.

$ git clone https://github.com/googlecodelabs/admob-firebase-codelabs-unity

The repository contains four folders as follows:

  • android_studio_folder.png101-base — Starting code that you will build in this codelab.
  • android_studio_folder.png101-complete_and_102-base — Completed code for this codelab & starter for the 102 codelab.
  • android_studio_folder.png102-complete — Completed code for the 102 codelab.

Prepare required files

The Awesome Drawing Quiz uses several open-source codes, which are required to compile and run the project.

Open the terminal, and move to the repository root directory. Then, run ./gradlew :prepareThirdPartyFiles (gradlew.bat :prepareThirdPartyFiles on Windows) from the terminal to copy required files into the project.

Import the starter app

Launch Unity, choose "Open" in the welcome screen. Then select the 101-base directory from the code you have downloaded.

You should now have the project open in Unity.

3. Setup Rewarded Video Ad Unit (Optional)

The starter app already includes a dedicated Rewarded Video Ad Unit for your convenience. You are entirely free to skip this step if you don't want to create a new one under your AdMob account.

Setup for Android

To create a new AdMob app in your account, please follow the instructions as follows:

  1. Go to the AdMob Console.
  2. From the Apps menu, click "Add App".
  3. When asked "Have you published your app on Google Play or the App Store," answer "NO."
  4. Name the app "Awesome Drawing Quiz," choose "Android" as the Platform, then click "Add".

Once you created an AdMob app in your account, follow the steps as described in the below to create a new Rewarded Video Ad Unit.

  1. Click the Apps menu in AdMob frontend, then select "Awesome Drawing Quiz" from the app list.
  2. Click the Ad units menu, then click ADD AD UNIT to create a new Rewarded Video ad unit.
  3. Select Rewarded for the Ad format.

7672f41ec611101b.png

  1. Provide the name of the ad unit as you prefer. Then, set reward amount to 1, and reward item to "hint" (these are the reward the app currently gives to users). And click CREATE AD UNIT to create a new Rewarded Video ad unit.

6d067814a2c38264.png

  1. When successfully created, you will see the instructions like the following.

4bc1b3b341a5a81c.png

  1. Go back to the Unity project, and update the AdMob app id and ad unit id constants to the ones that you have created in the previous step.

Ads/AdManager.cs

namespace AwesomeDrawingQuiz.Ads {
    public class AdManager {

        public const string APP_ID_ANDROID = "YOUR_ADMOB_APP_ID";
        
        ...

        #elif UNITY_ANDROID
        private const string APP_ID = APP_ID_ANDROID;
        public const string AD_UNIT_ID = "<YOUR_AD_UNIT_ID>";

        ...
    }
}

Setup for iOS

To create a new AdMob app in your account, please follow the instructions as follows:

  1. Go to the AdMob Console.
  2. From the Apps menu, click "Add App".
  3. When asked "Have you published your app on Google Play or the App Store," answer "NO."
  4. Name the app "Awesome Drawing Quiz," choose "iOS" as the Platform, then click "Add".

Once you created an AdMob app in your account, follow the steps as described in the below to create a new Rewarded Video Ad Unit.

  1. Click the Apps menu in AdMob frontend, then select "Awesome Drawing Quiz" from the app list.
  2. Click the Ad units menu, then click ADD AD UNIT to create a new Rewarded Video ad unit.
  3. Select Rewarded for the Ad format.

7672f41ec611101b.png

  1. Provide the name of the ad unit as you prefer. Then, set reward amount to 1, and reward item to "hint" (these are the reward the app currently gives to users). And click CREATE AD UNIT to create a new Rewarded Video ad unit.

6d067814a2c38264.png

  1. When successfully created, you will see the instructions like the following.

4bc1b3b341a5a81c.png

  1. Go back to the Unity project, and update the AdMob app id and ad unit id constants to the ones that you have created in the previous step.

Ads/AdManager.cs

namespace AwesomeDrawingQuiz.Ads {
    public class AdManager {

        public const string APP_ID_IOS = "YOUR_ADMOB_APP_ID";
        
        ...

        #elif UNITY_IOS
        private const string APP_ID = APP_ID_IOS;
        public const string AD_UNIT_ID = "<YOUR_AD_UNIT_ID>";

        ...
    }
}

4. Add Google Mobile Ads Unity Plugin

Import the plugin

To serve AdMob Ads on the Unity app, you need to add the Google Mobile Ads Unity Plugin into the project.

  1. Download the Google Mobile Ads Unity Plugin 3.18.1 package. (Note that this Codelab may not compatible with the other version of the plugin)
  2. In the Awesome Drawing Quiz Unity project. In the project, navigate to Assets > Import Package > Custom Package.
  3. Import the GoogleMobileAds.unitypackage into the project that you have downloaded.

Configure AdMob app ID

In the Unity editor, select Assets > Google Mobile Ads > Settings from the menu.

44fc84fe88235c1f.png

Enable AdMob by clicking Enabled checkbox under Google AdMob section. Then enter the AdMob app ID as follows:

  • Android: ca-app-pub-3940256099942544~3048611032
  • iOS: ca-app-pub-3940256099942544~2753522596

a6ad7402d4daf330.png

5. Setup Firebase Project

Create a new project from the Firebase Console

  1. Go to the Firebase console.
  2. Select Add Project, and name your project "Awesome Drawing Quiz".

Add the Unity app

  1. From the overview screen of your new project, click Add Firebase to your Unity app.
  2. Check Register as iOS app checkbox.
  3. Enter the iOS bundle id as: com.codelab.awesomedrawingquiz.unity
  4. Provide an app nickname as: Awesome Drawing Quiz (Unity on iOS)
  5. Check Register as Android app checkbox.
  6. Enter the Android package name as: com.codelab.awesomedrawingquiz.unity
  7. Provide an app nickname as: Awesome Drawing Quiz (Unity on Android)
  8. Select Register App to register both Android and iOS apps.

Add Firebase config files to the Unity project

Next, you will be prompted a screen where you can download a configuration file that contains all the necessary Firebase metadata for your app. Download the google-service.json and the GoogleService-Info.plist file, then move both of them into the android_studio_folder.pngAssets folder in the Unity project.

331c165d80ba105e.png

Add Firebase Analytics SDK

  1. Download the Firebase Unity SDK 5.5.0 and unzip it somewhere convenient.
  2. Open the Awesome Drawing Quiz Unity project, navigate to Assets > Import Package > Custom Package.
  3. From the unzipped SDK, import the Remote Config SDK (dotnet4/FirebaseAnalytics.unitypackage).
  4. In the Import Unity package window, click Import.

6. Link AdMob to Firebase Project

Complete the steps below to link your apps to Firebase.

  1. Sign in to your AdMob account at https://apps.admob.com.
  2. Click Apps in the sidebar.
  3. Select "Awesome Drawing Quiz". If you don't see it in the list of recent apps, you can click View all apps to search a list of all of the apps you've added to AdMob.
  4. Click App settings in the sidebar.
  5. Click Link to Firebase.
  6. Select "Link to an existing Firebase project and create a new Firebase app" option. Then Select "Awesome Drawing Quiz" project from the dropdown menu.
  7. Once you click the "CONTINUE" button, you'll see "Successfully linked" message. Click the "DONE" button to finish.

Once you link your AdMob app to Firebase Project, it will unlock some additional features both on AdMob and Firebase console as follows:

Revenue card (AdMob)

From the Revenue card, you can take a holistic look at all possible revenue streams in a single place. Supported revenue sources are as follows:

  • AdMob (Estimated)
  • Mediated Ad Networks (Observed)
  • In-app purchases
  • E-Commerce purchases

10fe118249e11150.png

User metrics card (AdMob)

From the user metrics card, you can see how changes to your ads experience might impact user behavior.

5f56366f1b31d4a1.png

Rewarded Ads Report (AdMob)

The Rewarded Ads Report offers a variety of metrics that will help publishers understand how users are interacting with their rewarded ads.

658a2868777690ea.png

Total revenue card (Firebase)

After you link your AdMob app to Firebase, Total revenue card on Firebase dashboard will display the revenue from the AdMob along with in-app-purchases and e-commerce purchases.

98cb283977b023a.png

Ad events reporting (Firebase)

Ad-specific events (click, impression, and reward events) are automatically collected and available for use in Google Analytics for Firebase.

bf77bd8c00c1441b.png

7. Run the project

Once you compile and run the project, you'll see the following screen when the app starts.

f5fbf4565c5d8647.png

Once you click ‘START A GAME,' you'll see a drawing on the screen. Your mission is to guess the name of the drawing by using the hint displayed on the top, from which you can infer the first letter and the length of the drawing's name.

bbdf4d23fb08a519.png ad82d7e657945c4d.png

If you don't have any idea what the name of the drawing is, you can skip the level by clicking the ‘SKIP' button.

You may want an additional clue that helps you guess the answer. You can get an extra clue by clicking the ‘HINT' button and watching a Rewarded Video ad. After you complete watching the ad, one extra letter will be disclosed as a reward.

8c33687361f83a13.png b048d6587c10e9df.png

8. Add app events

To deeply understand the user journey in the Awesome Drawing Quiz, you will define a few custom events that track user's behavior in the game as follows:

Event name

Triggered...

Parameters

game_start

when a user starts a new game

none

level_start

when a user starts a new level (a new drawing quiz) within a stage. (there are 6 levels in one stage)

level_name

level_wrong_answer

when a user submits a wrong answer

level_name

ad_reward_prompt

when a user taps the hint button, and is prompted to watch a Rewarded Video Ad

ad_unit_id

ad_reward_impression

when a user starts to watch a Rewarded Video Ad

ad_unit_id

level_success

when a user submits a correct answer (clears a level)

level_name, number_of_attempts, elapsed_time_sec, hint_used

level_fail

when a user skips a level

level_name, number_of_attempts, elapsed_time_sec, hint_used

game_complete

when the game is over

number_of_correct_answers

Description of each parameter associated with each event is as follows:

Event name

Parameter name

Description

level_start

level_name

Name of the drawing shown in the level (e.g., "banana")

level_wrong_answer

level_name

Name of the drawing shown in the level (e.g., "banana")

ad_reward_prompt

ad_unit_id

An ad unit id used to display a Rewarded Video Ad

ad_reward_impression

ad_unit_id

An ad unit id used to display a Rewarded Video Ad

level_success

level_name

Name of the drawing shown in the level (e.g., "banana")

level_success

number_of_attempts

Number of attempts made to clear a level

level_success

elapsed_time_sec

Elapsed time to clear a level, in seconds

level_success

hint_used

Whether a user used a hint (watched a Rewarded Video Ad) or not to clear a level (1: used a hint / 0: cleared a level without a hint)

level_fail

level_name

Name of the drawing shown in the level (e.g., "banana")

level_fail

number_of_attempts

Number of attempts made to clear a level

level_fail

elapsed_time_sec

Elapsed time to clear a level, in seconds

level_fail

hint_used

Whether a user used a hint (watched a Rewarded Video Ad) or not to clear a level (1: used a hint / 0: cleared a level without a hint)

game_complete

number_of_correct_answers

Number of levels cleared in the game

Create a helper class for logging custom events

To log the analytics event with ease, you will create a helper class to manage custom events.

First, create a new folder under the Assets/Scripts folder, and name it Analytics. Then create a new C# Script and name it QuizAnalytics.cs under Analytics folder.

Add the below code into the QuizAnalytics.cs file.

Analytics/QuizAnalytics.cs

using Firebase.Analytics;

namespace AwesomeDrawingQuiz.Analytics {

    public class QuizAnalytics {

        private const string EVENT_AD_REWARD_PROMPT = "ad_reward_prompt";

        private const string EVENT_AD_REWARD_IMPRESSION = "ad_reward_impression";

        private const string EVENT_LEVEL_FAIL = "level_fail";

        private const string EVENT_LEVEL_SUCCESS = "level_success";

        private const string EVENT_LEVEL_WRONG_ANSWER = "level_wrong_answer";

        private const string EVENT_GAME_START = "game_start";

        private const string EVENT_GAME_COMPLETE = "game_complete";

        private const string PARAM_AD_UNIT_ID = "ad_unit_id";

        private const string PARAM_ELAPSED_TIME_SEC = "elapsed_time_sec";

        private const string PARAM_HINT_USED = "hint_used";

        private const string PARAM_NUMBER_OF_ATTEMPTS = "number_of_attempts";

        private const string PARAM_NUMBER_OF_CORRECT_ANSWERS = "number_of_correct_answers";

        public const string SCREEN_MAIN = "main";

        public const string SCREEN_GAME = "game";

        public static void LogGameStart() {
            FirebaseAnalytics.LogEvent(EVENT_GAME_START);
        }

        public static void LogLevelStart(string levelName) {
            FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLevelStart, 
                FirebaseAnalytics.ParameterLevelName, levelName);
        }

        public static void LogLevelWrongAnswer(string levelName) {
            FirebaseAnalytics.LogEvent(EVENT_LEVEL_WRONG_ANSWER, 
                FirebaseAnalytics.ParameterLevelName, levelName);
        }

        public static void LogAdRewardPrompt(string adUnitId) {
            FirebaseAnalytics.LogEvent(EVENT_AD_REWARD_PROMPT, PARAM_AD_UNIT_ID, adUnitId);
        }

        public static void LogAdRewardImpression(string adUnitId) {
            FirebaseAnalytics.LogEvent(EVENT_AD_REWARD_IMPRESSION, PARAM_AD_UNIT_ID, adUnitId);
        }

        public static void LogLevelSuccess(
            string levelName, int numberOfAttemps, int elapsedTimeInSec, bool hintUsed
        ) {
            FirebaseAnalytics.LogEvent(EVENT_LEVEL_SUCCESS, new Parameter[] {
                new Parameter(FirebaseAnalytics.ParameterLevelName, levelName),
                new Parameter(PARAM_NUMBER_OF_ATTEMPTS, numberOfAttemps),
                new Parameter(PARAM_ELAPSED_TIME_SEC, elapsedTimeInSec),
                new Parameter(PARAM_HINT_USED, hintUsed ? 1 : 0)
            });
        }

        public static void LogLevelFail(
            string levelName, int numberOfAttempts, int elapsedTimeInSec, bool hintUsed
        ) {
            FirebaseAnalytics.LogEvent(EVENT_LEVEL_FAIL, new Parameter[] {
                new Parameter(FirebaseAnalytics.ParameterLevelName, levelName),
                new Parameter(PARAM_NUMBER_OF_ATTEMPTS, numberOfAttempts),
                new Parameter(PARAM_ELAPSED_TIME_SEC, elapsedTimeInSec),
                new Parameter(PARAM_HINT_USED, hintUsed ? 1 : 0)
            });
        }

        public static void LogGameComplete(int numberOfCorrectAnswers) {
            FirebaseAnalytics.LogEvent(EVENT_GAME_COMPLETE, 
                PARAM_NUMBER_OF_CORRECT_ANSWERS, numberOfCorrectAnswers);
        }

        public static void SetScreenName(string screenName) {
            FirebaseAnalytics.SetCurrentScreen(screenName, null);
        }
    }
}

Log analytics events in the game

Open the Game.cs file under Assets/Scripts/Scenes folder. To use the QuizAnalytics class, which is located under the AwesomeDrawingQuiz.Analytics namespace, add the using directive as follows.

Scenes/Game.cs

using AwesomeDrawingQuiz.Ads;

// TODO: Import AwesomeDrawingQuiz.Analytics (101)
using AwesomeDrawingQuiz.Analytics;

...

namespace AwesomeDrawingQuiz.Scene {
   ...
}

Next, in the Start() function, call the QuizAnalytics.SetScreenName()to change the name of the current screen. Also, call the QuizAnalytics.LogGameStart() to indicate a game has started.

Scenes/Game.cs

void Start () {
    // TODO: Log screen name (101)
    QuizAnalytics.SetScreenName(QuizAnalytics.SCREEN_GAME);

    ...

    SetHintButtonEnabled(false);

    // TODO: Log game_start event (101)
    QuizAnalytics.LogGameStart();
    
    ...
}

Next, in the callback functions, add calls to log custom events as follows:

Scenes/Game.cs

public void OnClickHint() {
    // TODO: Log ad_reward_prompt event (101)
    QuizAnalytics.LogAdRewardPrompt(AdManager.AD_UNIT_ID);

    ...
}

...
  
public void OnAdStarted(object sender, EventArgs args) {
    // TODO: Log ad_reward_impression event (101)
    QuizAnalytics.LogAdRewardImpression(AdManager.AD_UNIT_ID);
}

...

public void OnGameOver(object sender, GameOverEventArgs args) {
    // TODO: Log game_complete event (101)
    QuizAnalytics.LogGameComplete(args.NumCorrectAnswers);

    ...
}

public void OnLevelCleared(object sender, LevelClearEventArgs args) {
    // TODO: Log level_success event (101)
    QuizAnalytics.LogLevelSuccess(
        args.Drawing.word, args.NumAttempts, args.ElapsedTimeInSeconds, args.IsHintUsed);

    ...
}

public void OnLevelSkipped(object sender, LevelSkipEventArgs args) {
    // TODO: Log level_fail event (101)
    QuizAnalytics.LogLevelFail(
        args.Drawing.word, args.NumAttempts, args.ElapsedTimeInSeconds, args.IsHintUsed);
}

public void OnNewLevel(object sender, NewLevelEventArgs args) {
    // TODO: Log level_start event (101)
    QuizAnalytics.LogLevelStart(args.Drawing.word);

    ...
}

public void OnWrongAnwser(object sender, WrongAnswerEventArgs args) {
    // TODO: Log level_wrong_answer event (101)
    QuizAnalytics.LogLevelWrongAnswer(args.Drawing.word);

    ...
}

Finally, update the Main.cs file under Assets/Scripts/Scenes folder. You should make sure whether the Firebase is ready before you call any methods in the Firebase SDK.

Scenes/Main.cs

using AwesomeDrawingQuiz.Ads;

// TODO: Import AwesomeDrawingQuiz.Analytics (101)
using AwesomeDrawingQuiz.Analytics;

...

namespace AwesomeDrawingQuiz.Scene {
    public class Main : MonoBehaviour {

        ...

        void Start () {
            Screen.sleepTimeout = SleepTimeout.SystemSetting;

            #if UNITY_ANDROID
            // Disable 'Start a game' button until
            // Firebase dependencies are ready to use on the Android
            buttonStartGame.interactable = false;

            // TODO: Check Google Play Services on Android (101)
            // Check Google Play Services on Android device is up to date
            Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
                var dependencyStatus = task.Result;
                if (dependencyStatus == Firebase.DependencyStatus.Available) {
                    Debug.Log("All Firebase services are available");
                    
                    // TODO: Set screen name (101)
                    QuizAnalytics.SetScreenName(QuizAnalytics.SCREEN_MAIN);
                } else {
                    throw new System.InvalidOperationException(System.String.Format(
                        "Could not resolve all Firebase dependencies: {0}", dependencyStatus));
                }
            }).ContinueWith(task => {
                // Enable 'Start a game' button
                UnityMainThreadDispatcher.Instance()
                    .Enqueue(() => buttonStartGame.interactable = true);
            });
            #else
            
            // TODO: Set screen name (101)
            QuizAnalytics.SetScreenName(QuizAnalytics.SCREEN_MAIN);
            #endif
        }

        ...
    }
}   

9. Debug analytics events

You can use DebugView to verify events being correctly logged. DebugView enables you to see the raw event data logged by your app on development devices in near real-time.

This is very useful for validation purposes during the instrumentation phase of development and can help you discover errors and mistakes in your analytics implementation.

Enable debug mode on Android

Generally, events logged in your app are batched together over a period of approximately one hour and uploaded together. To validate your analytics implementation on the fly, you need to enable Debug mode on your development device to upload events with minimal delays.

First, open Terminal tool in Android Studio. It is located at the bottom toolbar.

c8dc1b4f08a224b8.png

Then execute the following command (make sure test Android device is connected to your computer or Android Emulator is running):

adb shell setprop debug.firebase.analytics.app com.google.codelab.awesomedrawingquiz

This behavior persists until you explicitly disable Debug mode by executing the following command:

adb shell setprop debug.firebase.analytics.app .none.

Enable debug mode on iOS

To enable Analytics Debug mode on your development device, specify the following command line argument in Xcode:

-FIRDebugEnabled

This behavior persists until you explicitly disable Debug mode by specifying the following command line argument:

-FIRDebugDisabled

Debug Analytics events with DebugView

Once you have enabled Debug mode on your test device, go to the Firebase console and select DebugView from the menu. Then, on your test device, play your game to see events being logged and shown on the DebugView report.

827059255d09ac00.png

You can access detailed information about each event by clicking the event name. As an example, the following screenshot shows parameter details associated with the level_start event.

475db00d05d03ab8.png

Please refer to DebugView help center article for more details.

10. Enable parameter reporting

Google Analytics for Firebase will collect total number of event counts by default, but reporting for custom parameters needs to be turned on explicitly for each event parameter you're interested in. Once this is enabled, Google Analytics for Firebase will display additional cards to show the stats for custom parameters.

To register custom parameters for an event:

  1. Go to the Firebase console and select the Awesome Drawing Quiz project you created earlier.
  2. Click Events from the navigation menu.
  1. In the row for the event you want to modify, click 73afe611adf58774.png> Edit Parameter reporting.

aad40de06ee0c3ad.png

  1. In the Enter parameter name field, enter the name of the parameter you'd like to register.

Note: If no match is found, just enter the parameter name then click ADD.e066c761aae4797f.png 5. Refer to the table below, and set the Type field to Text or Number accordingly. For numeric parameters, make sure you set the Unit of Measurement field as well. 6. Click the SAVE button to finish the setup.

Enable parameter reporting on each event listed below.

Event name

Parameter name

Parameter type

Unit of Measurement

level_start

level_name

Text

N/A

level_wrong_answer

level_name

Text

N/A

level_success

level_name

Text

N/A

level_success

number_of_attempts

Number

Standard

level_success

elapsed_time_sec

Number

Seconds

level_success

hint_used

Number

Standard

level_fail

level_name

Text

N/A

level_fail

number_of_attempts

Number

Standard

level_fail

elapsed_time_sec

Number

Seconds

level_fail

hint_used

Number

Standard

game_complete

number_of_correct_answers

Number

Standard

The following example shows custom parameter reporting setup for level_success event:

6d569c8c27df2914.png

Once you complete the parameter reporting setup, you'll be able to see parameters associated with each event that has parameter reporting turned on.

d1a37589d54bca6b.png

11. Get insights from the Event report

As you've added a few events in the game, you should be able to answer the questions regarding the user behavior of the game. Here are a few insights that you can get from the Firebase events report.

Which level has the highest number of wrong answers?

To answer this question, you should find out how many level_wrong_answer events were triggered per each level.

Click the level_wrong_answer from the events report. In the level_wrong_answer event report, find the level_name card. You'll see the values associated to the level_name parameter on that card as follows.

25da426bbc0c612c.png

According to the above screenshot, you can easily find out the horizon has the highest number of wrong answers, which means it's difficult to users compared to the other levels.

By using the insight you've got from here, you can decide not to provide difficult levels to novice users to keep a high retention rate.

How many attempts were made to clear a level, on average?

In the Awesome Drawing Quiz, users can submit the answer to each level as much as they want.

Since you've enabled parameter reporting on the number_of_attempts parameter in the level_success event, you can see the detailed metrics for that parameter.

Click the level_success event from the events report. In the level_success event report, find the number_of_attemps card. You'll see the average number of attempts on that card as follows:

43de290f9f1a0ac9.png

You can use the insight from here to optimize the difficulty of the game on average. For example, if the average number of attempts are too close to 1, you may consider making the game a little bit more challenging.

Did users try to solve the question by getting a hint, even though they failed to clear a level at last?

When a user decides to skip a level, a level_fail event is triggered. There can be many reasons for the user's decision.

However, since the game can give them a hint after they watch a Rewarded Video Ad, it's important to know that whether the user tried to clear the level with the help of the hint, at least.

Click the level_fail event from the events report. In the level_fail event report, find the hint_used card. You'll see the average number of hint_used event parameters. Note that when a hint is used it is set to 1 while it is set to 0 when a hint was not used.

313814372cd7c8a4.png

If the numbers on the hint_used card are close to 0, it's the signal that the reward (hint) is not quite attractive to the users. Also, you're losing the opportunity to increase the revenue from Rewarded Video Ad.

Therefore, you should consider making the reward to be more helpful to the users, so users can engage the game more deeply as well as the revenue from Rewarded Video Ad can be uplifted.

How many levels were cleared in each game, on average?

There are a total of 6 levels per each game in the Awesome Drawing Quiz. Once the user finishes six levels (no matter they cleared or failed each level), a game_complete event is triggered with number_of_correct_answers as a parameter.

Since number_of_correct_answers indicates how many levels that the user has cleared (provided a correct answer), you can find the answer by looking at the metrics of the number_of_correct_answers parameter.

Click game_complete event from the events report. In the game_complete event report, find the number_of_correct_answers card. You'll see the average number of number_of_correct_answers event parameters.

d9eeaa019d1bceb4.png

If the average number of cleared levels is too low, you should consider rearranging the game to help people to beat a level, so they can keep playing your game without losing their interest.

12. All done!

You have completed AdMob+Firebase 101 Unity Codelab. You can find the completed code for this Codelab on android_studio_folder.png101-complete_and_102-base folder.

In the next part of the AdMob+Firebase Codelab, you'll learn how to use a funnel to visualize the app event flow. Also, it'll cover how to use the Remote Config and A/B testing to optimize the parameter value in the game without an app update.