作为第三方与 Google Ad Manager 集成
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
第三方不是 Ad Manager 的直接用户,因为他们可能没有自己的 Ad Manager 广告资源网。不过,他们可以为其客户(即 Ad Manager 客户)创建服务或与 Ad Manager 进行集成。本指南提供了最佳做法、提示和技巧,介绍了第三方集成的基础知识。
本指南假定您已具备有关 Ad Manager API 的应用知识。如果您不熟悉 Ad Manager API,请参阅我们的入门文档。
第三方入门
要使用 Ad Manager API 访问 Ad Manager 客户的广告联盟,只需遵循以下指南即可。您无需获得 Google 的任何额外批准,但请注意,访问和/或使用 Ad Manager API 即表示您同意 Ad Manager API 条款及条件。
如何作为第三方测试您的 Ad Manager 集成
作为第三方,您可能想知道如何在针对客户的正式版广告联盟投放广告之前测试您的 Ad Manager 集成。建议的方法是创建测试广告联盟。您无需是 Ad Manager 客户也可创建帐号。任何拥有 Google 帐号的用户都可以创建测试广告联盟
但请注意,测试网络与生产网络之间的差异。测试广告联盟无法投放广告。此外,测试网络不一定包含您的客户端在其生产网络上可能提供的所有特性。如果您需要对测试广告资源网中未提供的 Ad Manager 功能进行测试,请通过 Ad Manager 转销商购买对非测试广告资源网的访问权限。
此外,您应该向客户明确说明,他们需要在其生产网络上提供哪些功能才能使您的应用正常运行。您的应用应通过捕获异常并正常失败,或保留客户端列表以及每个客户端具有或不具备哪些功能来应对功能可能不存在的情况。您的客户应负责与其在 Google 的联系人合作,管理其网络上的功能。
身份验证:如何正确访问客户的 Ad Manager 广告资源网
为了让您的应用能够访问客户的 Ad Manager 广告资源网,您需要安全地设置身份验证工作流程。
这就涉及到以下两个步骤:
- 创建将用于访问客户端网络的 Google 帐号电子邮件地址。
- 让客户将此帐号添加为其 Ad Manager 广告资源网的用户。
对于第 1 步,您可以为每个客户分别创建一个 Google 帐号,也可以创建一个用于所有客户的主帐号。如果您的其中一个帐号被盗用,第一种方式要更加安全。第二步意味着您只需执行第 1 步一次。
无论您在第 1 步中采取了什么措施,在第 2 步中,您都需要让每位新客户将您为其创建的 Google 帐号添加为其 Ad Manager 广告联盟的用户。
1. 创建 Google 账号
您可以通过多种方式创建可添加到 Ad Manager 广告资源网的 Google 帐号。
方法 1:创建一个 OAuth2 服务帐号,该帐号会为您生成一个可充当 Google 帐号的服务帐号电子邮件地址。关于创建新服务帐号的说明。
方法 2:您可以通过以新用户的身份注册来创建常规 Google 帐号(“Gmail”帐号)。如果您已有 Google 帐号,请在无痕式窗口或新的浏览器会话中完成此注册。或者,如果您的公司使用 Google Workspace,您可以在公司的网域中创建一个 Google 帐号并改用该帐号。在本指南中,我们将这两个帐号称为“常规”Google 帐号。
2. 请客户将您的 Google 账号添加到他们的广告资源网中
在获取可访问您客户的广告联盟的 Google 帐号后,请让您的客户将该帐号作为新用户添加到他们的 Ad Manager 广告联盟中。
无论您采取哪种路线,都请务必与客户讨论您的帐号应具有的角色和权限,以便您的应用可以访问在客户网络上需要的数据。
现在,您可以开始向客户的 Ad Manager 广告资源网发出 API 调用了。请务必将 networkCode SOAP 标头设置为您要向其发出 API 调用的客户端广告联盟代码。我们的所有客户端库都允许以编程方式进行此项设置。例如,在广告 Java 客户端库中,您可以在构建 DfpSession 实例时以编程方式设置广告联盟代码。
了解 API 的最新动态
请务必及时了解哪些 API 版本已弃用或停用,以及新版本的发布时间。您肯定不希望在某个版本被弃用时措手不及,从而有可能破坏您的客户端。我们并不总是能够像对待客户那样,就即将弃用和停用的事宜与第三方联系。因此,您有责任订阅我们的三个主要渠道之一,以便获取 API 更新信息并调整通知设置:
我们还会在开发者网站上提供弃用时间表,请定期查看该时间表。
获取支持
如果您在 Ad Manager 集成方面遇到问题,请根据您的具体问题通过我们提供的以下支持渠道获取帮助。如果您遇到的是产品层面的问题,请在 Ad Manager 产品论坛中发帖提问。如果您遇到的是 API 方面的问题,请在 Ad Manager API 论坛中发帖提问。请参阅这篇博文中的提示,了解如何区分问题是属于产品层面的问题还是特定于 API 的问题。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[[["\u003cp\u003eThis guide provides best practices for third-party developers integrating with Ad Manager for their clients, assuming familiarity with the Ad Manager API.\u003c/p\u003e\n"],["\u003cp\u003eTesting integrations is recommended using a test network, with awareness of its limitations compared to production networks and client feature dependencies.\u003c/p\u003e\n"],["\u003cp\u003eSecure authentication involves creating a Google account (service account or regular account) and adding it as a user to the client's Ad Manager network with appropriate permissions.\u003c/p\u003e\n"],["\u003cp\u003eStaying informed about API updates and deprecations through the announcements group, developer blog, and deprecation schedule is crucial for maintaining integration functionality.\u003c/p\u003e\n"],["\u003cp\u003eSupport for product or API-specific questions can be found in the Ad Manager product forums or the Ad Manager API forums, respectively.\u003c/p\u003e\n"]]],[],null,["# Integrating with Google Ad Manager as a third party\n\nThird parties are not direct users of Ad Manager, in that they may not have\ntheir own Ad Manager network. Instead, they create services or integrations with\nAd Manager for their clients, who are Ad Manager customers. This guide covers\nthe basics of third party integrations by providing best practices, tips, and\ntricks.\n\nThis guide assumes you have a working knowledge of the Ad Manager API. If you're\nunfamiliar with the Ad Manager API, please see our [getting started\ndocumentation](/ad-manager/api/start).\n\nGetting started as a third party\n--------------------------------\n\nTo use the Ad Manager API to access an Ad Manager customer's network just follow\nthe guidelines below. No additional approval from Google is required, though\nnote that by accessing and/or using the Ad Manager API you agree to the Ad\nManager API [terms and\nconditions](http://www.google.com/doubleclick/tos/dfp-api-terms.html).\n\nHow to test your Ad Manager integration as a third party\n--------------------------------------------------------\n\nAs a third party, you may be wondering how to test your Ad Manager integration\nbefore running against your clients' production networks. The recommended\napproach is to [create a test network](/ad-manager/api/environments). You don't\nneed to be an Ad Manager customer to do this. Anybody with a Google account can\ncreate a test network.\n\nNote, however, the [differences between test and production\nnetworks](/ad-manager/api/environments). Test networks cannot serve ads. Test\nnetworks will also not necessarily contain all the features that your clients\nmay have available on their production networks. If you need to test against Ad\nManager features that are not available on your test network, one option is to\npurchase access to a non-test network through an Ad Manager reseller.\n\nIn addition, you should be clear with your clients about what features they need\nto have available on their production network in order for your application to\nwork properly. Your application should handle cases where features may not exist\nby either catching exceptions and failing gracefully or keeping a list of your\nclients and what features each one has or doesn't have. It should be your\nclient's responsibility to work with their contact at Google to manage features\non their network.\n\nAuthentication: How to properly access a client's Ad Manager network\n--------------------------------------------------------------------\n\nIn order for your application to access your client's Ad Manager network, you\nneed to set up your authentication workflow in a secure manner.\n\nThis involves two steps:\n\n1. Create a Google account email address that you will use to access your client's network.\n2. Have the client add this account as a user to their Ad Manager network.\n\nFor step 1, you can create either a separate Google account for each client, or\na primary one that you will use for all clients. The former option is more\nsecure in the case that one of your accounts is compromised. The latter means\nyou only need to do step 1 once.\n\nNo matter what you do for step 1, in step 2 you'll need to ask each new client\nto add the appropriate Google account you created for them as a user to their Ad\nManager network.\n\n### 1. Creating a Google account\n\nThere are various ways to create a Google account that can be added to an Ad\nManager network.\n\n- Option 1: Create an [OAuth2 service\n account](/identity/protocols/oauth2/service-account), which generates a\n service account email address for you that acts as a Google account.\n [Instructions for creating a new service\n account](/ad-manager/api/authentication#oauth).\n\n- Option 2: You can create a regular Google account (\"Gmail\" account) by\n [signing up as a new\n user](//accounts.google.com/signup/v2/webcreateaccount?flowName=GlifWebSignIn&flowEntry=SignUp).\n If you already have a Google account, complete this signup in an incognito\n window or new browser session. Or, if your company uses [Google\n Workspace](//workspace.google.com/), you can create a Google account in your\n company's domain and use that instead. For the purposes of this guide, we will\n refer to both of these as a \"regular\" Google account.\n\n### 2. Ask the client to add your Google account to their network\n\nAfter you've obtained a Google account to access your client's network, ask them\nto add the account as a new user in their Ad Manager network.\n\n- If you are providing them with an OAuth2 service account email address, have\n them [add it to their network](/ad-manager/api/authentication#configure).\n\n- If you are providing them with a regular Google account, have them [add your\n account](//support.google.com/admanager/answer/3059181) as a user to their\n network.\n\nNo matter which route you take, ensure that you discuss with your client what\n[roles and permissions](//support.google.com/admanager/answer/177403) your\naccount should have so that your application can access the data it needs on\nyour client's network.\n\nNow you can start making API calls to your client's Ad Manager network. Make\nsure you set the [networkCode SOAP header](/ad-manager/api/soap_xml) to the\nclient's network code you are making the API call against. All of our client\nlibraries allow setting this programmatically. For example, in the ads Java\nclient library, you can [programmatically set the network\ncode](//github.com/googleads/googleads-java-lib/blob/2.1.0/modules/ads_lib/src/main/java/com/google/api/ads/dfp/lib/client/DfpSession.java#L216)\nwhen building a DfpSession instance.\n\nKeeping up to date with the API\n-------------------------------\n\nIt's important that you stay up to date on which API versions are deprecated or\nsunset and when new versions are released. You don't want to be caught off guard\nwhen a version is sunset and risk breaking your clients. We are not always able\nto reach out to third parties about impending deprecations and sunsets as we do\nfor our customers. Thus, it is your responsibility to subscribe to one of our\nthree main channels for API updates and adjust your notification settings:\n\n- Our [Ad Manager API Sunsets Announcements\n Group](//groups.google.com/g/dfpapi-sunset-announce).\n- Our [Ads Developer Blog](//ads-developers.googleblog.com/).\n\nWe also provide a [deprecation schedule](/ad-manager/api/deprecation) on our\ndeveloper's site that you should monitor regularly.\n\nGetting support\n---------------\n\nIf you run into issues with your Ad Manager integration, we offer the following\nsupport channels depending on your issue. If you have a product-level question,\nplease write to the [Ad Manager product\nforums](//support.google.com/admanager/). If you have an API specific question,\nplease write to the [Ad Manager API\nforums](//groups.google.com/g/google-doubleclick-for-publishers-api).\nPlease see [this blog\npost](//ads-developers.googleblog.com/2015/06/help-us-help-you-with-your-dfp-api.html)\nfor tips on distinguishing whether something is a product-level question or an\nAPI specific question."]]