基本概念
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页简要介绍了 Google Ad Manager API 的架构,并介绍了 Ad Manager 中的一般概念和术语。
API 架构
以下图表简单地介绍了 Ad Manager API 中的主要类,以及各个类之间的关系:

订单
Order
对象包含有关订单的一般信息(如货币或销售人员),并且包含一个或多个 LineItem
实例。在代码中,每个 LineItem
保留其所属 Order
的 ID,而不是 Order
保留 LineItem
对象列表。
LineItem
LineItem
对象描述了要展示广告的一组要求,包括广告的展示方式和时间、应展示的广告素材尺寸以及展示顺序(顺序、加权或根据效果)、这些广告的优先级,以及描述费用结构的许多属性。LineItem
包含一个 InventoryTargeting
对象(描述它可定位的 AdUnit
和 Placement
对象),以及可选的其他 Targeting
子类对象(表示地理位置、自定义或其他条件)。
LineItemCreativeAssociation
LineItemCreativeAssociation
(通常称为 LICA)将一个 LineItem
关联到一个 Creative
。订单项可与多个广告素材相关联,根据您的帐号类型,您也许可以将一个广告素材与多个订单项相关联。在您创建 LineItemCreativeAssociation
时,Ad Manager 首先会检查广告素材和订单项是否兼容;例如,如果它们的尺寸不同,则您在尝试创建或更新关联时会收到错误消息。该对象还可让您替换关联的 LineItem
中的某些值,如开始/结束日期或尺寸(如果您的广告素材与订单项指定的尺寸不太一致,而您愿意让 Ad Manager 来调整广告素材的尺寸,使其适合正在投放的广告单元)。LICA 不会在 Ad Manager 界面中显示,它们是 API 惯例。
广告素材
Creative
表示实际广告。如果广告由 Ad Manager 托管,则此对象包含实际的图片字节、Flash 文件或存储在 Ad Manager 服务器上的自定义 HTML 代码;如果广告素材托管在第三方网站上,则此广告素材是从第三方服务器发送请求的网址或 HTML 代码段。
Inventory 定位和定位子类
InventoryTargeting
对象会列出与特定 LineItem
相关联的广告单元。您可以使用相应 Targeting
子类的其他实例来指定其他可选的定位条件。
展示位置
Placement
对象是一个或多个 AdUnit
对象的集合。
AdUnit
AdUnit
表示一个或多个页面上的广告位置。AdUnit
可以是 LineItem
的 InventoryTargeting
对象的目标,也可以是 Placement
对象的目标。AdUnit
对象包含尺寸、ID 和唯一名称。ID 用于标识 API 中的其他 AdUnit
对象;名称用作 HTML 代码中的唯一标识符,以标识特定的 AdUnit
对象,并作为网页请求的一部分发送回 Ad Manager。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[[["\u003cp\u003eThe Google Ad Manager API uses objects like Orders, Line Items, and Creatives to structure and manage ad campaigns.\u003c/p\u003e\n"],["\u003cp\u003eLine Items define ad requirements, targeting criteria, and cost structures, and are linked to Creatives via LineItemCreativeAssociations.\u003c/p\u003e\n"],["\u003cp\u003eCreatives represent the actual ads, which can be hosted by Ad Manager or a third-party server.\u003c/p\u003e\n"],["\u003cp\u003eAd Units represent ad locations on web pages and are targeted by Line Items or Placements, which are collections of Ad Units.\u003c/p\u003e\n"],["\u003cp\u003eInventory Targeting specifies which Ad Units are associated with a Line Item, while Targeting subclasses allow for additional criteria like geography or custom attributes.\u003c/p\u003e\n"]]],["The Google Ad Manager API's core components include `Order`, `LineItem`, `LineItemCreativeAssociation` (LICA), `Creative`, `InventoryTargeting`, `Placement`, and `AdUnit`. An `Order` contains `LineItem` instances, which define ad display requirements. A LICA links a `LineItem` to a `Creative`. `InventoryTargeting` links ad units to `LineItem`. `Placement` is a collection of `AdUnit`, representing ad locations. `Creative` is the actual ad content. AdUnits can be used to identify other adUnits.\n"],null,["# Basic Concepts\n\nThis page provides an overview\nof the architecture of the Google Ad Manager API and describes general concepts and terms in Ad Manager.\n\nAPI Architecture\n----------------\n\nHere is a simplified diagram of the main classes in the Ad Manager API, and how they relate to each other:\n\nOrder\n-----\n\n: An [Order](/ad-manager/api/reference/latest/OrderService.Order) object holds general information about the order such as the currency or salesperson, and contains one or more `LineItem` instances. In code, each `LineItem` holds the ID of its containing `Order`, rather than the `Order` holding a list of `LineItem` objects.\n\nLineItem\n--------\n\n: A [LineItem](/ad-manager/api/reference/latest/LineItemService.LineItem) object describes a set of requirements for an ad to show, including how\n and when the ads should be shown, the sizes of the creatives it should show and\n the order in which to show them (in order, weighted, or according to their performance),\n the priority of these ads, and many properties describing the cost structure. A\n `LineItem` has one `InventoryTargeting` object that describes which `AdUnit` and `Placement` objects it can target, and optional additional `Targeting` subclass objects that represent geographical, custom, or other criteria.\n\nLineItemCreativeAssociation\n---------------------------\n\n: A [LineItemCreativeAssociation](/ad-manager/api/reference/latest/LineItemCreativeAssociationService.LineItemCreativeAssociation) (often called a LICA) links one `LineItem` to\n one `Creative`. Line items can be linked to more than one creative, and depending on your account type, you might be able to link a creative to more than one line item. When you create a `LineItemCreativeAssociation`,\n Ad Manager first checks whether both the creative and the line item are compatible;\n if the sizes differ, for instance, you'll get an error when you try to create\n or update the association. This object also lets you override some values in the associated `LineItem`,\n such as start/end dates, or size (if you have a creative that doesn't\n quite fit the size specified by the line item, but you are willing to let Ad Manager\n adjust the size of the creative to fit the ad unit on the fly). LICAs are not exposed in the Ad Manager user interface; they are an API convention.\n\nCreative\n--------\n\n: A [Creative](/ad-manager/api/reference/latest/CreativeService.Creative) represents the actual ad. If the ad is hosted by Ad Manager,\n this object holds the actual image bytes, flash files, or custom HTML tags stored\n on Ad Manager's servers; if the creative is hosted on a\n third-party site, the creative is a URL or HTML snippet that makes the\n request from the third-party server.\n\nInventoryTargeting and Targeting subclasses\n-------------------------------------------\n\n: The [InventoryTargeting](/ad-manager/api/reference/latest/LineItemService.InventoryTargeting) object lists which ad units are associated with a specific `LineItem`. You can specify additional, optional targeting criteria using additional instances of an appropriate subclass of [`Targeting`](/ad-manager/api/reference/latest/LineItemService.Targeting).\n\nPlacement\n---------\n\n: A [Placement](/ad-manager/api/reference/latest/PlacementService.Placement) object is a collection of one or more `AdUnit` objects.\n\nAdUnit\n------\n\n: An [AdUnit](/ad-manager/api/reference/latest/InventoryService.AdUnit) represents an ad location on one or more pages. An `AdUnit` can be a target of either a `LineItem`'s `InventoryTargeting` object or a `Placement` object. An `AdUnit` object includes a size, an ID, and a unique name. The ID is used to identify other `AdUnit` objects within the API; the name is used as a unique identifier in the HTML tags to identify a specific `AdUnit` object, and is sent back to Ad Manager as part of the page request."]]