Import the Firebase Analytics Unity Plugin
1) Download the FirebaseAnalytics-12.4.0.unitypackage
2) Import the .unitypackage file by selecting the Unity menu option Assets > Import Package > Custom Package and import all items.
Initialise the SDK
1) Download the custom scripts & prefabs here.
2) Drag '_FirebaseAnalyticsInit.prefab' to Splash Scene to initialise the scripts only once.
3) Drag Firebase Console downloaded files 'google-services.json', 'GoogleService-Info.plist' to Assets
4) Fix Firebase macOS verification on Apple Devices while playing game in Unity Editor.
Solution:
Open Settings > Privacy & Security > Firebase.bundle > Allow Anyway
Select 'Open' to fix the warning.
Log events
The following example level logs events:
Start: FirebaseAnalytics.LogEvent("level_start_" + GameData.GetCurrentLevel());
Fail: FirebaseAnalytics.LogEvent("level_fail_" + GameData.GetCurrentLevel());
Finish: FirebaseAnalytics.LogEvent("level_finish_" + GameData.GetCurrentLevel());
GitHub Commit: Files too large
Issue: The following files are over 100MB. If you commit these files, you will no longer be able to push this repository to GitHub.com
Assets/Firebase/Plugins/x86_64/FirebaseCppApp-12_0_0.so
Solution:
Open GitHubDesktop > Repository > Open in Terminal
1) MacOS Setup (Using Homebrew): Open Terminal and run brew update, brew install git-lfs
2) git lfs track "*.so"
3) git add path/to/file.so (Right click on .so Repository file in GitHub Desktop > Reveal in finder)
4) git commit -m "added firebase file.so"
5) Push Origin in GitHub Desktop Current Repository