Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void runExample(
// Center account with merchantCenterAccountId.
try (MerchantCenterLinkServiceClient merchantCenterLinkService =
googleAdsClient.getLatestVersion().createMerchantCenterLinkServiceClient()) {
// [START ApproveMerchantCenterLink]
// [START approve_merchant_center_link]
ListMerchantCenterLinksResponse response =
merchantCenterLinkService.listMerchantCenterLinks(
ListMerchantCenterLinksRequest.newBuilder()
Expand All @@ -118,14 +118,14 @@ private void runExample(
System.out.printf(
"%d Merchant Center link(s) found with the following details:%n",
response.getMerchantCenterLinksCount());
// [END ApproveMerchantCenterLink]
// [END approve_merchant_center_link]

for (MerchantCenterLink merchantCenterLink : response.getMerchantCenterLinksList()) {
// [START ApproveMerchantCenterLink_1]
// [START approve_merchant_center_link_1]
System.out.printf(
"Link '%s' has status '%s'.%n",
merchantCenterLink.getResourceName(), merchantCenterLink.getStatus());
// [END ApproveMerchantCenterLink_1]
// [END approve_merchant_center_link_1]

// Checks if there is a link for the Merchant Center account we are looking for, then only
// approves the link if it is in a 'PENDING' state.
Expand All @@ -151,7 +151,7 @@ private void runExample(
* @param status the new status to set on the link.
* @throws GoogleAdsException if an API request failed with one or more service errors.
*/
// [START ApproveMerchantCenterLink_2]
// [START approve_merchant_center_link_2]
private void updateMerchantCenterLinkStatus(
MerchantCenterLinkServiceClient merchantCenterLinkServiceClient,
long customerId,
Expand Down Expand Up @@ -183,5 +183,5 @@ private void updateMerchantCenterLinkStatus(
"Updated Merchant Center link with resource name: '%s'.%n",
merchantCenterLinkResult.getResourceName());
}
// [END ApproveMerchantCenterLink_2]
// [END approve_merchant_center_link_2]
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static void main(String[] args) {
}
}

// [START CreateCustomer]
// [START create_customer]
private void runExample(GoogleAdsClient googleAdsClient, Long managerId) {
// Formats the current date/time to use as a timestamp in the new customer description.
String dateTime = ZonedDateTime.now().format(DateTimeFormatter.RFC_1123_DATE_TIME);
Expand Down Expand Up @@ -110,5 +110,5 @@ private void runExample(GoogleAdsClient googleAdsClient, Long managerId) {
response.getResourceName(), managerId);
}
}
// [END CreateCustomer]
// [END create_customer]
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static void main(String[] args) {
* @param googleAdsClient the client instance.
* @param customerId the customerId for which to retrieve change status.
*/
// [START GetAccountChanges]
// [START get_account_changes]
private void runExample(GoogleAdsClient googleAdsClient, long customerId) {
String query =
"SELECT change_status.resource_name, "
Expand Down Expand Up @@ -123,7 +123,7 @@ private void runExample(GoogleAdsClient googleAdsClient, long customerId) {
}
}
}
// [END GetAccountChanges]
// [END get_account_changes]

/**
* Each returned row contains all possible changed fields. This function returns the resource name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static void main(String[] args) throws IOException {
}

/** Runs the example. */
// [START LinkManagerToClient]
// [START link_manager_to_client]
private void runExample(GoogleAdsClient googleAdsClient, long clientCustomerId, long managerId) {
// This example assumes that the same credentials will work for both customers, but that may not
// be the case. If you need to use different credentials for each customer, then you may either
Expand Down Expand Up @@ -164,5 +164,5 @@ private void runExample(GoogleAdsClient googleAdsClient, long clientCustomerId,
response.getResults(0).getResourceName());
}
}
// [END LinkManagerToClient]
// [END link_manager_to_client]
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void main(String[] args) {
*
* @param client the GoogleAdsClient instance to use.
*/
// [START ListAccessibleCustomers]
// [START list_accessible_customers]
private void runExample(GoogleAdsClient client) {
// Optional: Change credentials to use a different refresh token, to retrieve customers
// available for a specific user.
Expand All @@ -94,5 +94,5 @@ private void runExample(GoogleAdsClient client) {
}
}
}
// [END ListAccessibleCustomers]
// [END list_accessible_customers]
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private void runExample(
* @param merchantCenterLink the MerchantCenterLink object to remove.
* @throws GoogleAdsException if an API request failed with one or more service errors.
*/
// [START RejectMerchantCenterLink]
// [START reject_merchant_center_link]
private void removeMerchantCenterLink(
MerchantCenterLinkServiceClient merchantCenterLinkServiceClient,
long customerId,
Expand All @@ -163,5 +163,5 @@ private void removeMerchantCenterLink(
System.out.printf(
"Removed Merchant Center link with resource name: '%s'.%n", result.getResourceName());
}
// [END RejectMerchantCenterLink]
// [END reject_merchant_center_link]
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private void runExample(GoogleAdsClient googleAdsClient, AddAdCustomizerParams p
* @param feedName the name of the feed to create.
* @return the resource name of the newly created feed.
*/
// [START AddAdCustomizer]
// [START add_ad_customizer]
private String createAdCustomizerFeed(
GoogleAdsClient googleAdsClient, long customerId, String feedName) {

Expand Down Expand Up @@ -221,7 +221,7 @@ private String createAdCustomizerFeed(
return feedResourceName;
}
}
// [END AddAdCustomizer]
// [END add_ad_customizer]

/**
* Retrieves all the attributes for a feed and returns them in a map using the attribute names as
Expand All @@ -232,7 +232,7 @@ private String createAdCustomizerFeed(
* @param feedResourceName the resource name of the feed.
* @return the attributes of the feed.
*/
// [START AddAdCustomizer_1]
// [START add_ad_customizer_1]
private Map<String, FeedAttribute> getFeedAttributes(
GoogleAdsClient googleAdsClient, long customerId, String feedResourceName) {
String query =
Expand Down Expand Up @@ -265,7 +265,7 @@ private Map<String, FeedAttribute> getFeedAttributes(
}
return feedAttributes;
}
// [END AddAdCustomizer_1]
// [END add_ad_customizer_1]

/**
* Creates a feed mapping and sets the feed as an ad customizer feed.
Expand All @@ -275,7 +275,7 @@ private Map<String, FeedAttribute> getFeedAttributes(
* @param feedResourceName the resource name of the feed.
* @param feedAttributes the attributes of the feed.
*/
// [START AddAdCustomizer_2]
// [START add_ad_customizer_2]
private void createAdCustomizerMapping(
GoogleAdsClient googleAdsClient,
long customerId,
Expand Down Expand Up @@ -327,7 +327,7 @@ private void createAdCustomizerMapping(
"Added feed mapping with resource name %s.%n", response.getResults(0).getResourceName());
}
}
// [END AddAdCustomizer_2]
// [END add_ad_customizer_2]

/**
* Creates two different feed items to enable two different ad customizations.
Expand All @@ -338,7 +338,7 @@ private void createAdCustomizerMapping(
* @param feedAttributes the attributes of the feed.
* @return the resource names of the feed items.
*/
// [START AddAdCustomizer_3]
// [START add_ad_customizer_3]
private List<String> createFeedItems(
GoogleAdsClient googleAdsClient,
long customerId,
Expand Down Expand Up @@ -381,7 +381,7 @@ private List<String> createFeedItems(
return feedItemResourceNames;
}
}
// [END AddAdCustomizer_3]
// [END add_ad_customizer_3]

/**
* Helper function to create a FeedItemOperation.
Expand All @@ -393,7 +393,7 @@ private List<String> createFeedItems(
* @param feedAttributes the attributes to be set on the feed.
* @return a FeedItemOperation to create a feed item.
*/
// [START AddAdCustomizer_4]
// [START add_ad_customizer_4]
private FeedItemOperation createFeedItemOperation(
String name,
String price,
Expand Down Expand Up @@ -428,7 +428,7 @@ private FeedItemOperation createFeedItemOperation(

return FeedItemOperation.newBuilder().setCreate(feedItem).build();
}
// [END AddAdCustomizer_4]
// [END add_ad_customizer_4]

/**
* Restricts the feed items to work only with a specific ad group; this prevents the feed items
Expand All @@ -440,7 +440,7 @@ private FeedItemOperation createFeedItemOperation(
* @param adGroupIds the ad group IDs to bind the feed items to.
* @param feedItemResourceNames the resource names of the feed items.
*/
// [START AddAdCustomizer_5]
// [START add_ad_customizer_5]
private void createFeedItemTargets(
GoogleAdsClient googleAdsClient,
long customerId,
Expand Down Expand Up @@ -475,7 +475,7 @@ private void createFeedItemTargets(
}
}
}
// [END AddAdCustomizer_5]
// [END add_ad_customizer_5]

/**
* Creates expanded text ads that use the ad customizer feed to populate the placeholders.
Expand All @@ -485,7 +485,7 @@ private void createFeedItemTargets(
* @param adGroupIds the ad group IDs in which to create the ads.
* @param feedName the name of the feed.
*/
// [START AddAdCustomizer_6]
// [START add_ad_customizer_6]
private void createAdsWithCustomizations(
GoogleAdsClient googleAdsClient, long customerId, List<Long> adGroupIds, String feedName) {

Expand Down Expand Up @@ -532,5 +532,5 @@ private void createAdsWithCustomizations(
}
}
}
// [END AddAdCustomizer_6]
// [END add_ad_customizer_6]
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static void main(String[] args) {
* @param bidModifier the bid modifier value to set
* @throws GoogleAdsException if an API request failed with one or more service errors.
*/
// [START AddAdGroupBidModifier]
// [START add_ad_group_bid_modifier]
private void runExample(
GoogleAdsClient googleAdsClient, long customerId, long adGroupId, double bidModifier) {

Expand Down Expand Up @@ -135,5 +135,5 @@ private void runExample(
}
}
}
// [END AddAdGroupBidModifier]
// [END add_ad_group_bid_modifier]
}
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ private static void createFeedItems(
* @param feedResourceName the resource name of the feed.
* @param campaignId the campaign ID of the campaign to update.
*/
// [START AddDynamicPageFeed_1]
// [START add_dynamic_page_feed_1]
private static void updateCampaignDsaSetting(
GoogleAdsClient googleAdsClient, long customerId, String feedResourceName, long campaignId) {
// Retrieves the existing dynamic search ads settings for the campaign.
Expand Down Expand Up @@ -397,7 +397,7 @@ private static void updateCampaignDsaSetting(
"Updated campaign with resource name '%s'.%n", response.getResults(0).getResourceName());
}
}
// [END AddDynamicPageFeed_1]
// [END add_dynamic_page_feed_1]

/**
* Returns the DSA settings for a campaign. Throws an error if the campaign does not exist or is
Expand All @@ -408,7 +408,7 @@ private static void updateCampaignDsaSetting(
* @param campaignId the campaign ID of the campaign to update.
* @return the DSA settings for the campaign.
*/
// [START AddDynamicPageFeed]
// [START add_dynamic_page_feed]
private static DynamicSearchAdsSetting getDsaSetting(
GoogleAdsClient googleAdsClient, long customerId, long campaignId) {
// Creates the query.
Expand Down Expand Up @@ -459,7 +459,7 @@ private static DynamicSearchAdsSetting getDsaSetting(
.getDynamicSearchAdsSetting();
}
}
// [END AddDynamicPageFeed]
// [END add_dynamic_page_feed]

/**
* Creates an ad group criterion targeting the DSA label.
Expand All @@ -469,7 +469,7 @@ private static DynamicSearchAdsSetting getDsaSetting(
* @param adGroupId the ad group ID.
* @param dsaPageUrlLabel the label for the DSA page URLs.
*/
// [START AddDynamicPageFeed_2]
// [START add_dynamic_page_feed_2]
private static void addDsaTarget(
GoogleAdsClient googleAdsClient, long customerId, long adGroupId, String dsaPageUrlLabel) {
String adGroupResourceName = ResourceNames.adGroup(customerId, adGroupId);
Expand Down Expand Up @@ -515,5 +515,5 @@ private static void addDsaTarget(
response.getResults(0).getResourceName());
}
}
// [END AddDynamicPageFeed_2]
// [END add_dynamic_page_feed_2]
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private static String addCampaignBudget(GoogleAdsClient googleAdsClient, long cu
* @param budgetResourceName the campaign budget resource name.
* @return the campaign resource name.
*/
// [START AddDynamicSearchAds]
// [START add_dynamic_search_ads]
private static String addCampaign(
GoogleAdsClient googleAdsClient, long customerId, String budgetResourceName) {
// Creates the campaign.
Expand Down Expand Up @@ -202,7 +202,7 @@ private static String addCampaign(
return campaignResourceName;
}
}
// [END AddDynamicSearchAds]
// [END add_dynamic_search_ads]

/**
* Adds an ad group.
Expand All @@ -212,7 +212,7 @@ private static String addCampaign(
* @param campaignResourceName the campaign resource name.
* @return the ad group resource name.
*/
// [START AddDynamicSearchAds_1]
// [START add_dynamic_search_ads_1]
private static String addAdGroup(
GoogleAdsClient googleAdsClient, long customerId, String campaignResourceName) {
// Creates the ad group.
Expand Down Expand Up @@ -241,7 +241,7 @@ private static String addAdGroup(
return adGroupResourceName;
}
}
// [END AddDynamicSearchAds_1]
// [END add_dynamic_search_ads_1]

/**
* Adds an expanded dynamic search ad.
Expand All @@ -250,7 +250,7 @@ private static String addAdGroup(
* @param customerId the client customer ID.
* @param adGroupResourceName the ad group resource name.
*/
// [START AddDynamicSearchAds_2]
// [START add_dynamic_search_ads_2]
private static void addExpandedDSA(
GoogleAdsClient googleAdsClient, long customerId, String adGroupResourceName) {
// Creates an ad group ad.
Expand Down Expand Up @@ -283,7 +283,7 @@ private static void addExpandedDSA(
"Added ad group ad with resource name '%s'.%n", response.getResults(0).getResourceName());
}
}
// [END AddDynamicSearchAds_2]
// [END add_dynamic_search_ads_2]

/**
* Adds webpage targeting criteria for the DSA.
Expand Down
Loading