AdsApp.TopicBuilder
Stay organized with collections
Save and categorize content based on your preferences.
Builder for Topic
objects. Example usage:
var
topicBuilder
=
adGroup
.
display
()
.
newTopicBuilder
();
var
topic
=
topicBuilder
.
withTopicId
(
3
)
//
required
.
withCpc
(
0.50
)
//
optional
.
build
()
//
create
the
topic
Methods:
build()
Builds the topic. Returns a TopicOperation
that corresponds to
the creation of the Topic
. Return values:
exclude()
Builds the excluded topic. Returns an ExcludedTopicOperation
that
corresponds to the creation of the ExcludedTopic
. Return values:
withCpc(cpc)
Sets the max CPC bid of the new topic to the specified value. Arguments:
Return values:
withCpm(cpm)
Sets the CPM bid of the new topic to the specified value. See Cost-per-thousand
impressions (CPM)
for more information.
Arguments:
Return values:
withTopicId(topicId)
Sets the topic ID of the topic. This field is required. The topic ID
identifies the topic category. A list of valid topic IDs is available on
our Verticals
page. Arguments:
Return values:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eThe TopicBuilder facilitates the creation and management of topics for targeting in Google Ads campaigns.\u003c/p\u003e\n"],["\u003cp\u003eIt allows for specifying the topic ID, setting maximum CPC or CPM bids, and building or excluding topics.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ewithTopicId\u003c/code\u003e method is mandatory and uses a topic ID to identify the desired category, while \u003ccode\u003ewithCpc\u003c/code\u003e and \u003ccode\u003ewithCpm\u003c/code\u003e are optional for setting bids.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild\u003c/code\u003e method creates a TopicOperation to add the topic, while the \u003ccode\u003eexclude\u003c/code\u003e method creates an ExcludedTopicOperation to exclude it.\u003c/p\u003e\n"]]],[],null,["# AdsApp.TopicBuilder\n\nBuilder for [Topic](/google-ads/scripts/docs/reference/adsapp/adsapp_topic) objects.\n\nExample usage:\n\n```gdscript\nvar topicBuilder = adGroup.display().newTopicBuilder();\nvar topic = topicBuilder\n .withTopicId(3) // required\n .withCpc(0.50) // optional\n .build() // create the topic\n```\n\n### Methods:\n\n| Member | Type | Description |\n|----------------------------------------------|----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|\n| [build()](#build) | [AdsApp.TopicOperation](/google-ads/scripts/docs/reference/adsapp/adsapp_topicoperation) | Builds the topic. |\n| [exclude()](#exclude) | [AdsApp.ExcludedTopicOperation](/google-ads/scripts/docs/reference/adsapp/adsapp_excludedtopicoperation) | Builds the excluded topic. |\n| [withCpc(cpc)](#withCpc_cpc) | [AdsApp.TopicBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_topicbuilder) | Sets the max CPC bid of the new topic to the specified value. |\n| [withCpm(cpm)](#withCpm_cpm) | [AdsApp.TopicBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_topicbuilder) | Sets the CPM bid of the new topic to the specified value. |\n| [withTopicId(topicId)](#withTopicId_topicId) | [AdsApp.TopicBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_topicbuilder) | Sets the topic ID of the topic. |\n\n`build()`\n---------\n\nBuilds the topic. Returns a [TopicOperation](/google-ads/scripts/docs/reference/adsapp/adsapp_topicoperation) that corresponds to the creation of the [Topic](/google-ads/scripts/docs/reference/adsapp/adsapp_topic).\n\n### Return values:\n\n| Type | Description |\n|------------------------------------------------------------------------------------------|---------------------|\n| [AdsApp.TopicOperation](/google-ads/scripts/docs/reference/adsapp/adsapp_topicoperation) | The TopicOperation. |\n\n`exclude()`\n-----------\n\nBuilds the excluded topic. Returns an [ExcludedTopicOperation](/google-ads/scripts/docs/reference/adsapp/adsapp_excludedtopicoperation) that corresponds to the creation of the [ExcludedTopic](/google-ads/scripts/docs/reference/adsapp/adsapp_excludedtopic).\n\n### Return values:\n\n| Type | Description |\n|----------------------------------------------------------------------------------------------------------|-----------------------------|\n| [AdsApp.ExcludedTopicOperation](/google-ads/scripts/docs/reference/adsapp/adsapp_excludedtopicoperation) | The ExcludedTopicOperation. |\n\n`withCpc(cpc)`\n--------------\n\nSets the max CPC bid of the new topic to the specified value.\n\n### Arguments:\n\n| Name | Type | Description |\n|------|----------|-------------------------------|\n| cpc | `double` | The max CPC bid of the topic. |\n\n### Return values:\n\n| Type | Description |\n|--------------------------------------------------------------------------------------|-----------------------------------------------|\n| [AdsApp.TopicBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_topicbuilder) | The topic builder with the specified max CPC. |\n\n`withCpm(cpm)`\n--------------\n\nSets the CPM bid of the new topic to the specified value.\n\nSee [Cost-per-thousand\nimpressions (CPM)](//support.google.com/google-ads/answer/6310) for more information.\n\n### Arguments:\n\n| Name | Type | Description |\n|------|----------|---------------------------|\n| cpm | `double` | The CPM bid of the topic. |\n\n### Return values:\n\n| Type | Description |\n|--------------------------------------------------------------------------------------|-------------------------------------------|\n| [AdsApp.TopicBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_topicbuilder) | The topic builder with the specified CPM. |\n\n`withTopicId(topicId)`\n----------------------\n\nSets the topic ID of the topic. This field is required. The topic ID identifies the topic category. A list of valid topic IDs is available on our [Verticals](/google-ads/api/reference/data/verticals) page.\n\n### Arguments:\n\n| Name | Type | Description |\n|---------|----------|----------------------------|\n| topicId | `String` | The topic ID of the topic. |\n\n### Return values:\n\n| Type | Description |\n|--------------------------------------------------------------------------------------|---------------------------------------------|\n| [AdsApp.TopicBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_topicbuilder) | A TopicBuilder with the specified topic ID. |"]]