Crashlytics에 광고 응답 정보 ID 로깅
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Firebase
Crashlytics는
앱의 안정성 문제를 쉽게 관리할 수 있는 간단한 실시간 비정상 종료 보고 도구입니다. Crashlytics를 사용하면 비정상 종료를 지능적으로 분류하고
비정상 종료로 이어지는 상황을 식별하여 문제 해결 시간을
단축할 수 있습니다.
이 가이드에서는 Crashlytics를 Unity 프로젝트에 통합하여
광고 응답 ID를 로깅하는 방법을 설명합니다. 나중에 앱의 비정상 종료 문제를 해결할 때
광고 응답 ID를 찾아 AdMob의 광고 심사 센터를 사용하여
문제가 되는 광고를 찾고 차단할 수 있습니다.
1단계: Unity 앱에 Firebase 추가
Firebase Unity 통합 가이드에 따라 Firebase Crashlytics를 Unity에 통합합니다.
2단계: 광고 응답 ID 로깅
MonoBehaviour 스크립트를 만들고 AdMob과 Firebase SDK를 모두 초기화합니다.
Crashlytics의 초기화 시점을 모니터링하려면 부울 isCrashlyticsInitialized
를 사용합니다.
using GoogleMobileAds.Api;
using Fabric.Crashlytics;
...
public class GameObjectScript : MonoBehaviour
{
bool isCrashlyticsInitialized = false;
public void Start()
{
....
// Initialize Google Mobile Ads SDK.
MobileAds.Initialize((InitializationStatus initStatus) => {});
....
// Initialize Firebase
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
Firebase.DependencyStatus dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
Firebase.FirebaseApp app = Firebase.FirebaseApp.DefaultInstance;
isCrashlyticsInitialized = true;
}
else
{
UnityEngine.Debug.LogError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}", dependencyStatus));
// Firebase Unity SDK is not safe to use here.
}
});
}
}
배너 광고를 요청합니다.
using GoogleMobileAds.Api;
using Fabric.Crashlytics;
...
public class GameObjectScript : MonoBehaviour
{
public void Start()
{
...
// Initialize Google Mobile Ads SDK.
MobileAds.Initialize((InitializationStatus initStatus) => {});
// Initialize Firebase.
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
Firebase.DependencyStatus dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
// Create and hold a reference to your FirebaseApp,
// where app is a Firebase.FirebaseApp property of your
// application class.
// Crashlytics will use the DefaultInstance, as well;
// this ensures that Crashlytics is initialized.
Firebase.FirebaseApp app = Firebase.FirebaseApp.DefaultInstance;
isCrashlyticsInitialized = true;
}
else
{
UnityEngine.Debug.LogError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}",dependencyStatus));
// Firebase Unity SDK is not safe to use here.
}
});
// Request Banner View.
this.RequestBanner();
...
}
public void RequestBanner()
{
#if UNITY_ANDROID
string adUnitId = "ca-app-pub-3940256099942544/6300978111";
#elif UNITY_IPHONE
string adUnitId = "ca-app-pub-1220882738324941/1255739139";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
this.bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);
// Called when an ad request has successfully loaded.
this.bannerView.OnAdLoaded += this.HandleOnAdLoaded;
AdRequest request = new AdRequest();
this.bannerView.LoadAd(request);
}
}
ResponseInfo
객체 OnAdLoaded
를 가져오고 응답 ID를 Crashlytics에
로깅합니다.
public void HandleOnAdLoaded()
{
ResponseInfo responseInfo = this.bannerView.GetResponseInfo();
if (responseInfo != null)
{
String adResponseId = responseInfo.GetResponseId();
// Log to Crashlytics.
if (isCrashlyticsInitialized)
{
Crashlytics.SetCustomKey("banner_ad_response_id", adResponseId);
}
}
}
작업이 끝났습니다. 이제 Crashlytics 대시보드에 있는 비정상 종료 세션의 키 섹션에 최신 banner_ad_response_id
가 표시됩니다. 일부 키는
대시보드에 표시되는 데 최대 4시간이 걸릴 수 있습니다.

달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-29(UTC)
[null,null,["최종 업데이트: 2025-08-29(UTC)"],[[["\u003cp\u003eFirebase Crashlytics helps you manage app stability by grouping crashes and highlighting their causes.\u003c/p\u003e\n"],["\u003cp\u003eThis guide shows you how to integrate Crashlytics into your Unity project and log ad response IDs.\u003c/p\u003e\n"],["\u003cp\u003eLogging ad response IDs with crash reports allows you to identify and block problematic ads using AdMob's Ad Review Center.\u003c/p\u003e\n"],["\u003cp\u003eIntegration involves adding Firebase to your Unity project, initializing the SDKs, requesting a banner ad, and logging the ad response ID to Crashlytics on ad load.\u003c/p\u003e\n"]]],["Firebase Crashlytics is integrated into a Unity project to log ad response IDs for troubleshooting. This involves initializing both the AdMob and Firebase SDKs, monitored by `isCrashlyticsInitialized`. A banner ad is requested, and upon successful loading (`OnAdLoaded`), the `ResponseInfo` object's response ID is retrieved. This ID is then logged to Crashlytics using `Crashlytics.SetCustomKey` and is accessible in the Crashlytics dashboard's crash session keys.\n"],null,["Select platform: [Android](/admob/android/crashlytics \"View this page for the Android platform docs.\") [iOS](/admob/ios/crashlytics \"View this page for the iOS platform docs.\") [Unity](/admob/unity/crashlytics \"View this page for the Unity platform docs.\")\n\n\u003cbr /\u003e\n\n[Firebase\nCrashlytics](//firebase.google.com/docs/crashlytics/get-started?platform=unity)\nis a lightweight, realtime crash reporter that makes it easy for you to manage\nstability issues in your app. Crashlytics saves you troubleshooting time by\nintelligently grouping crashes and highlighting the circumstances that lead up\nto them.\n\nThis guide describes how to integrate Crashlytics into your Unity project so\nthat you can log ad response IDs. Later, when you troubleshoot crashes in your\napp, you can look up the ad response IDs and use the [Ad Review Center in\nAdMob](//support.google.com/admob/answer/3500252) to find and block the ads.\n\nStep 1: Add Firebase to your Unity app\n\nFollow the [Firebase Unity integration\nguide](//firebase.google.com/docs/crashlytics/get-started?platform=unity) to\nintegrate Firebase Crashlytics into Unity.\n\nStep 2: Log the ad response ID\n\n1. Create a MonoBehaviour script and initialize both AdMob and Firebase SDKs.\n Use the boolean `isCrashlyticsInitialized` to monitor when Crashlytics\n initializes.\n\n using GoogleMobileAds.Api;\n using Fabric.Crashlytics;\n ...\n public class GameObjectScript : MonoBehaviour\n {\n bool isCrashlyticsInitialized = false;\n public void Start()\n {\n ....\n // Initialize Google Mobile Ads SDK.\n MobileAds.Initialize((InitializationStatus initStatus) =\u003e {});\n ....\n // Initialize Firebase\n Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =\u003e {\n Firebase.DependencyStatus dependencyStatus = task.Result;\n if (dependencyStatus == Firebase.DependencyStatus.Available)\n {\n Firebase.FirebaseApp app = Firebase.FirebaseApp.DefaultInstance;\n isCrashlyticsInitialized = true;\n }\n else\n {\n UnityEngine.Debug.LogError(System.String.Format(\n \"Could not resolve all Firebase dependencies: {0}\", dependencyStatus));\n // Firebase Unity SDK is not safe to use here.\n }\n });\n }\n }\n\n2. Request a banner ad.\n\n using GoogleMobileAds.Api;\n using Fabric.Crashlytics;\n ...\n public class GameObjectScript : MonoBehaviour\n {\n public void Start()\n {\n ...\n // Initialize Google Mobile Ads SDK.\n MobileAds.Initialize((InitializationStatus initStatus) =\u003e {});\n\n // Initialize Firebase.\n Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =\u003e {\n Firebase.DependencyStatus dependencyStatus = task.Result;\n if (dependencyStatus == Firebase.DependencyStatus.Available)\n {\n // Create and hold a reference to your FirebaseApp,\n // where app is a Firebase.FirebaseApp property of your\n // application class.\n // Crashlytics will use the DefaultInstance, as well;\n // this ensures that Crashlytics is initialized.\n Firebase.FirebaseApp app = Firebase.FirebaseApp.DefaultInstance;\n isCrashlyticsInitialized = true;\n }\n else\n {\n UnityEngine.Debug.LogError(System.String.Format(\n \"Could not resolve all Firebase dependencies: {0}\",dependencyStatus));\n // Firebase Unity SDK is not safe to use here.\n }\n });\n\n // Request Banner View.\n this.RequestBanner();\n ...\n }\n public void RequestBanner()\n {\n #if UNITY_ANDROID\n string adUnitId = \"ca-app-pub-3940256099942544/6300978111\";\n #elif UNITY_IPHONE\n string adUnitId = \"ca-app-pub-1220882738324941/1255739139\";\n #else\n string adUnitId = \"unexpected_platform\";\n #endif\n // Create a 320x50 banner at the top of the screen.\n this.bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);\n // Called when an ad request has successfully loaded.\n this.bannerView.OnAdLoaded += this.HandleOnAdLoaded;\n AdRequest request = new AdRequest();\n this.bannerView.LoadAd(request);\n }\n }\n\n3. Get the `ResponseInfo` object `OnAdLoaded` and log the response ID to\n Crashlytics.\n\n public void HandleOnAdLoaded()\n {\n ResponseInfo responseInfo = this.bannerView.GetResponseInfo();\n if (responseInfo != null)\n {\n String adResponseId = responseInfo.GetResponseId();\n // Log to Crashlytics.\n if (isCrashlyticsInitialized)\n {\n Crashlytics.SetCustomKey(\"banner_ad_response_id\", adResponseId);\n }\n }\n }\n\nThat's it! You can now see the most recent `banner_ad_response_id` in the key\nsection of crash sessions on your Crashlytics dashboard. Note that some keys may\ntake up to four hours to become visible on your dashboard."]]