2828import com .google .ads .googleads .v3 .enums .AdvertisingChannelTypeEnum .AdvertisingChannelType ;
2929import com .google .ads .googleads .v3 .enums .AssetTypeEnum .AssetType ;
3030import com .google .ads .googleads .v3 .enums .CampaignStatusEnum .CampaignStatus ;
31+ import com .google .ads .googleads .v3 .enums .DisplayAdFormatSettingEnum .DisplayAdFormatSetting ;
3132import com .google .ads .googleads .v3 .errors .GoogleAdsError ;
3233import com .google .ads .googleads .v3 .errors .GoogleAdsException ;
3334import com .google .ads .googleads .v3 .resources .Ad ;
6667import java .net .URL ;
6768
6869/**
69- * Creates a shopping campaign associated with an existing merchant center account, along with a
70- * related ad group and dynamic display ad, and targets a user list for remarketing purposes.
70+ * Creates a shopping campaign associated with an existing merchant center account, along with a
71+ * related ad group and dynamic display ad, and targets a user list for remarketing purposes.
7172 */
7273public class AddMerchantCenterDynamicRemarketingCampaign {
7374 private static class AddMerchantCenterDynamicRemarketingCampaignParams extends CodeSampleParams {
@@ -87,7 +88,7 @@ private static class AddMerchantCenterDynamicRemarketingCampaignParams extends C
8788
8889 public static void main (String [] args ) throws IOException {
8990 AddMerchantCenterDynamicRemarketingCampaignParams params =
90- new AddMerchantCenterDynamicRemarketingCampaignParams ();
91+ new AddMerchantCenterDynamicRemarketingCampaignParams ();
9192 if (!params .parseArguments (args )) {
9293
9394 // Either pass the required parameters for this example on the command line, or insert them
@@ -135,18 +136,18 @@ public static void main(String[] args) throws IOException {
135136 * @throws GoogleAdsException if an API request failed with one or more service errors.
136137 */
137138 private void runExample (
138- GoogleAdsClient googleAdsClient ,
139- AddMerchantCenterDynamicRemarketingCampaignParams params )
139+ GoogleAdsClient googleAdsClient , AddMerchantCenterDynamicRemarketingCampaignParams params )
140140 throws IOException {
141141 // Creates a shopping campaign associated with a given merchant center account.
142- String campaignResourceName = createCampaign (
143- googleAdsClient ,
144- params .customerId ,
145- params .merchantCenterAccountId ,
146- params .campaignBudgetId );
142+ String campaignResourceName =
143+ createCampaign (
144+ googleAdsClient ,
145+ params .customerId ,
146+ params .merchantCenterAccountId ,
147+ params .campaignBudgetId );
147148 // Creates an ad group for the campaign.
148- String adGroupResourceName = createAdGroup ( googleAdsClient , params . customerId ,
149- campaignResourceName );
149+ String adGroupResourceName =
150+ createAdGroup ( googleAdsClient , params . customerId , campaignResourceName );
150151 // Creates a dynamic display ad in the ad group.
151152 createAd (googleAdsClient , params .customerId , adGroupResourceName );
152153 // Targets a specific user list for remarketing.
@@ -258,10 +259,10 @@ private void createAd(
258259 String marketingImageName = "Marketing Image" ;
259260 String marketingImageResourceName =
260261 uploadAsset (googleAdsClient , customerId , marketingImageUrl , marketingImageName );
261- String logoImageName = "Logo Image" ;
262- String logoImageUrl = "https://goo.gl/mtt54n" ;
263- String logoImageResourceName =
264- uploadAsset (googleAdsClient , customerId , logoImageUrl , logoImageName );
262+ String squareMarketingImageName = "Square Marketing Image" ;
263+ String squareMarketingImageUrl = "https://goo.gl/mtt54n" ;
264+ String squareMarketingImageResourceName =
265+ uploadAsset (googleAdsClient , customerId , squareMarketingImageUrl , squareMarketingImageName );
265266
266267 // Creates the responsive display ad info object.
267268 ResponsiveDisplayAdInfo responsiveDisplayAdInfo =
@@ -271,7 +272,9 @@ private void createAd(
271272 .setAsset (StringValue .of (marketingImageResourceName ))
272273 .build ())
273274 .addSquareMarketingImages (
274- AdImageAsset .newBuilder ().setAsset (StringValue .of (logoImageResourceName )).build ())
275+ AdImageAsset .newBuilder ()
276+ .setAsset (StringValue .of (squareMarketingImageResourceName ))
277+ .build ())
275278 .addHeadlines (AdTextAsset .newBuilder ().setText (StringValue .of ("Travel" )).build ())
276279 .setLongHeadline (
277280 AdTextAsset .newBuilder ().setText (StringValue .of ("Travel the World" )).build ())
@@ -281,24 +284,26 @@ private void createAd(
281284 // Optional: Call to action text.
282285 // Valid texts: https://support.google.com/adwords/answer/7005917
283286 .setCallToActionText (StringValue .of ("Apply Now" ))
284- // Optional: Creates a logo image and set it to the ad.
285- .addLogoImages (
286- AdImageAsset .newBuilder ().setAsset (StringValue .of (logoImageResourceName )).build ())
287- // Optional: Creates a logo image and set it to the ad.
288- .addSquareLogoImages (
289- AdImageAsset .newBuilder ().setAsset (StringValue .of (logoImageResourceName )).build ())
290- // Whitelisted accounts only: Sets color settings using hexadecimal values.
291- // Sets allowFlexibleColor to false if you want your ads to render by always
292- // using your colors strictly.
293- /*
287+ // Optional: Sets the ad colors.
294288 .setMainColor (StringValue .of ("#0000ff" ))
295289 .setAccentColor (StringValue .of ("#ffff00" ))
290+ // Optional: Sets to false to strictly render the ad using the colors.
296291 .setAllowFlexibleColor (BoolValue .of (false ))
292+ // Optional: Sets the format setting that the ad will be served in.
293+ .setFormatSetting (DisplayAdFormatSetting .NON_NATIVE )
294+ // Optional: Creates a logo image and sets it to the ad.
295+ /*
296+ .addLogoImages(
297+ AdImageAsset.newBuilder()
298+ .setAsset(StringValue.of("INSERT_LOGO_IMAGE_RESOURCE_NAME_HERE"))
299+ .build())
297300 */
298- // Whitelisted accounts only: Sets the format setting that the ad will be
299- // served in.
301+ // Optional: Creates a square logo image and sets it to the ad.
300302 /*
301- .setFormatSetting(DisplayAdFormatSetting.NON_NATIVE)
303+ .addSquareLogoImages(
304+ AdImageAsset.newBuilder()
305+ .setAsset(StringValue.of("INSERT_SQUARE_LOGO_IMAGE_RESOURCE_NAME_HERE"))
306+ .build())
302307 */
303308 .build ();
304309
0 commit comments