整合 Tencent GDT 與中介服務
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本指南適用於有意透過 Tencent GDT,使用 Google Mobile Ads 中介服務的發布商。內容涵蓋如何設定中介服務轉接程式,以搭配現有的 iOS 應用程式運作,以及如何完成其他相關設定。
必要條件
實用入門資訊
如需中介服務的背景資訊,請參閱下列說明中心文章:
將騰訊 GDT 新增至專案
將廣告整合至應用程式,做法與以往相同。如要整合非插頁式廣告 (橫幅大小、排行榜大小等),請參閱「橫幅廣告」。如要整合插頁式廣告 (會遮蓋所有其他內容的全螢幕廣告),請參閱插頁式廣告。
按照下列步驟操作,即可將廣告刊登位置變更為中介服務刊登位置,顯示來自多個聯播網的廣告。
從上方資源下載 Tencent GDT 的轉接程式和 SDK。
在 Xcode 中新增下載的聯播網轉接程式/SDK:在專案上按一下滑鼠右鍵,然後點選「Add Files to project」(將檔案新增至 project)。
加入騰訊 GDT 所需的任何架構、編譯器標記或連結器標記。您不需要另外撰寫程式碼。中介服務會視需要叫用騰訊 GDT 轉接程式和 SDK,以建立廣告。
設定事件通知
如要接收曝光等廣告生命週期事件的通知,您可以實作 GADBannerViewDelegate
。使用中介服務時,系統會自動將 Tencent GDT 的事件通知給這個委派。舉例來說,任何廣告聯播網的曝光次數都會透過 GADBannerViewDelegate
的 adViewDidReceiveAd:
方法回報。
檢查 adNetworkClassName 的值
您可以選擇檢查 GADBannerView
上的 adNetworkClassName
屬性,該屬性會在呼叫 adViewDidReceiveAd
回呼後,傳回擷取目前橫幅的廣告聯播網類別名稱:
Swift
func adViewDidReceiveAd(_ bannerView: GADBannerView) {
print("Banner adapter class name: \(bannerView.adNetworkClassName)")
}
Objective-C
- (void)adViewDidReceiveAd:(GADBannerView *)bannerView {
NSLog(@"Banner adapter class name: %@", bannerView.adNetworkClassName);
}
同樣地,如果是插頁式廣告,請檢查 interstitialDidReceiveAd
內 GADInterstitialAd
的 adNetworkClassName
屬性:
Swift
func interstitialDidReceiveAd(_ ad: GADInterstitialAd) {
print("Interstitial adapter class name: \(ad.adNetworkClassName)")
}
Objective-C
- (void)interstitialDidReceiveAd:(GADInterstitialAd *)interstitial {
NSLog(@"Interstitial adapter class name: %@", interstitial.adNetworkClassName);
}
如果是 AdMob 傳回的廣告,則
adNetworkClassName
會傳回
GADMAdapterGoogleAdMobAds
。
如果是透過
自訂事件擷取的廣告,則會傳回
GADMAdapterCustomEvents
。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-02 (世界標準時間)。
[null,null,["上次更新時間:2025-09-02 (世界標準時間)。"],[[["\u003cp\u003eThis guide helps publishers integrate Tencent YLH with Google Mobile Ads mediation in their iOS apps.\u003c/p\u003e\n"],["\u003cp\u003eIt provides steps for setting up the mediation adapter and configuring necessary settings.\u003c/p\u003e\n"],["\u003cp\u003ePublishers should have an existing iOS app with Google Mobile Ads SDK and an AdMob account with configured ad units.\u003c/p\u003e\n"],["\u003cp\u003eEvent notifications, such as impressions, are automatically handled through the GADBannerViewDelegate or GADInterstitialDelegate.\u003c/p\u003e\n"],["\u003cp\u003eYou can identify the ad network that served the ad by checking the adNetworkClassName property.\u003c/p\u003e\n"]]],["Publishers integrating Tencent GDT with Google Mobile Ads mediation must download the Tencent GDT adapter and SDK. After downloading, add these files to the iOS project in Xcode, including any required frameworks or flags. Ad placement will then use mediation to display ads from multiple networks. Implement `GADBannerViewDelegate` to receive ad lifecycle event notifications and check `adNetworkClassName` to identify the serving ad network. This setup does not require additional code, as mediation invokes the Tencent GDT adapter.\n"],null,["This guide is intended for publishers who are interested in using Google\nMobile Ads mediation with **Tencent GDT**. It walks\nthrough the setup of a mediation adapter to work with your current iOS app\nand the configuration of additional settings.\n\n| Tencent GDT Resources |\n|----------------------------------------------------------------------------------------------|\n| [Documentation](http://e.qq.com/dev/#index) |\n| [SDK](http://imgcache.qq.com/qzone/biz/gdt/dev/sdk/ios/release/GDT_iOS_SDK.zip) |\n| [Adapter](http://imgcache.qq.com/qzone/biz/gdt/dev/sdk/ios/release/GDT_iOS_AdMobAdapter.zip) |\n| [Customer support](mailto:GDTLM@tencent.com) |\n\nPrerequisites\n\n- An iOS app with the Google Mobile Ads SDK integrated (If you don't\n have one, see [Get Started](/admob/ios/quick-start).)\n\n- An AdMob account and [an ad unit configured with mediation line\n items](//support.google.com/admob/answer/3124703).\n\nHelpful primers\n\nThe following Help Center articles provide background information on mediation:\n\n- [About AdMob Mediation](//support.google.com/admob/answer/3063564)\n- [Set up AdMob Mediation](//support.google.com/admob/answer/3124703)\n- [Optimize AdMob Network](//support.google.com/admob/answer/3534471)\n\nAdd Tencent GDT to your project\n\nIntegrate ads into your app the same as before. To integrate\nnon-interstitial ads (banner size, leaderboard size, and so on),\nsee [Banner Ads](/admob/ios/banner). To integrate\ninterstitial ads (full-screen ads that mask all other content),\nsee [Interstitial Ads](/admob/ios/interstitial).\n\nThe following steps change your ad placement into a mediation\nplacement that can show ads from multiple networks.\n\n1. Download the adapter and SDK for Tencent GDT from the\n [resources above](#resources).\n\n2. Add the downloaded network adapter/SDK in Xcode: right-click\n on your project and click **Add Files to \u003cvar class=\"readonly\" translate=\"no\"\u003eproject\u003c/var\u003e**.\n\n3. Include any frameworks, compiler flags, or linker flags that Tencent GDT\n require. There's no need to write additional code. Mediation invokes the\n Tencent GDT adapter and SDK as necessary to create ads.\n\nSet up event notification\n\nTo be notified of ad lifecycle events like impressions, you can implement\na `GADBannerViewDelegate`. When using mediation, this delegate is\nautomatically notified of events from Tencent GDT. For example, impressions\nfrom any ad network are reported through the `adViewDidReceiveAd:` method of\n`GADBannerViewDelegate`.\n\nCheck the value of adNetworkClassName\n\nYou can optionally check the `adNetworkClassName` property on\n`GADBannerView`, which returns the ad network class\nname of the ad network that fetched the current banner once the\n`adViewDidReceiveAd` callback is called: \n\nSwift \n\n func adViewDidReceiveAd(_ bannerView: GADBannerView) {\n print(\"Banner adapter class name: \\(bannerView.adNetworkClassName)\")\n }\n\nObjective-C \n\n - (void)adViewDidReceiveAd:(GADBannerView *)bannerView {\n NSLog(@\"Banner adapter class name: %@\", bannerView.adNetworkClassName);\n }\n\nSimilarly, for interstitials, check the `adNetworkClassName` property\non `GADInterstitialAd` inside `interstitialDidReceiveAd`: \n\nSwift \n\n func interstitialDidReceiveAd(_ ad: GADInterstitialAd) {\n print(\"Interstitial adapter class name: \\(ad.adNetworkClassName)\")\n }\n\nObjective-C \n\n - (void)interstitialDidReceiveAd:(GADInterstitialAd *)interstitial {\n NSLog(@\"Interstitial adapter class name: %@\", interstitial.adNetworkClassName);\n }\n\nFor ads returned from AdMob, `adNetworkClassName` returns `GADMAdapterGoogleAdMobAds`. For ads fetched through [custom events](/admob/ios/custom-events), it returns `GADMAdapterCustomEvents`.\n\n\u003cbr /\u003e"]]