Analytics

Google Analytics collects usage and behavior data for your app.

Before Starting

Firebase Features uses Unreal Engine's analytic system. To use this system as the default system for your project, you have to edit your project's configuration. Open <YourGame>/Config/DefaultEngine.ini and add the following lines:

[Analytics]
ProviderModuleName=FirebaseFeatures

Managing the Analytic Session

You can now start an Analytic Session with the following node:

BlueprintsC++
#include "Analytics/FirebaseAnalyticsLibrary.h"
void UMyGameInstance::StartPlay()
{
    Super::StartPlay();
    
    // Starts the analytics session.
    const bool bStarted = UFirebaseAnalyticsLibrary::StartSession();
    
    if (!bStarted)
    {
        // Handle session start error here.
    }
}
start analytics session blueprints code example

And if you want to end the session, you can call End Session at any time:

BlueprintsC++
#include "Analytics/FirebaseAnalyticsLibrary.h"
void UMyGameInstance::EndPlay(EEndPlayReason Reason)
{
    Super::EndPlay(Reason);
    
    // Ends the analytics session.
    UFirebaseAnalyticsLibrary::EndSession();
}
end analytics session blueprints code example

Logging Events

Now that the analytic session has started, you can start logging events. Firebase Features offers several methods to easily log different kinds of events:

firebase analytics logging node functions list for blueprints

Going Further

Firebase Features offers other methods to manage analytics. You can safely call them after you started the session.

firebase analytics nodes functions list for blueprints