Problem with updating UniversalAppCampaignSetting

126 views
Skip to first unread message

Sama Ra

unread,
Jun 24, 2019, 11:44:34 AM6/24/19
to AdWords API and Google Ads API Forum
I wanna to mange videos for my universal app campaign. Here is the code:

adwords = Adwords.get_api_client(XXX)
srv = adwords.service(:CampaignService, :v201809)
srv.mutate([
      { 
        operator: 'SET',
        operand: { 
          id: XXX,
          settings: [
            {
              xsi_type: 'UniversalAppCampaignSetting',
              settingType: 'UniversalAppCampaignSetting',
              youtubeVideoMediaIds: [YYY],
              youtubeVideoMediaIdsOps: ['REMOVE']
            }
          ]
        }
      }
    ])

which faults with:

/usr/local/bundle/gems/google-ads-common-1.0.2/lib/ads_common/parameters_validator.rb:156:in `check_extra_fields': AdsCommon::Errors::UnexpectedParametersError: [:settingType, :youtubeVideoMediaIds, :youtubeVideoMediaIdsOps] (AdsCommon::Errors::UnexpectedParametersError)

Whats wrong? Need your assistance because of lack of documentation / code samples

Google Ads API Forum Advisor Prod

unread,
Jun 24, 2019, 4:40:29 PM6/24/19
to qw4...@gmail.com, adwor...@googlegroups.com
Hi Sama, 

Could you please check if you are making these changes to the test accounts? If so, you will need to use the UniversalAppCampaignInfo in the CampaignService. You will no longer use a UniversalAppCampaignSetting, which includes both information about the app and references to media and descriptions that would be used for ads in that campaign. Please refer to this blog post for more information. If you are updating the campaign in a production account, could you please share the request and response logs which includes the complete error logs to check this further? You may share the details privately via Reply privately to author option.

Thanks,
Bharani, Google Ads API Team

ref:_00D1U1174p._5001UCZBhj:ref

Sama Ra

unread,
Jun 26, 2019, 4:46:08 PM6/26/19
to AdWords API and Google Ads API Forum
Good day, Bharani!

Thank you for your response! It was very helpful but unfortunately i have not achieved my goal (manage universal app ad videos). Here is key point of my researches:

- Google changes it's API and UniversalAppCampaignSetting won't be used to contain ad specific information
- To reach particular Ad i should use AdGroupAdService or AdService
- I have not succeed in managing videos of YouTubeVideoAsset of UniversalAppAd. Please have a look at my code snippet:

adwords = Adwords.get_api_client(customer_id)
srv = adwords.service(:AdService, :v201809)

srv.mutate([
  {
    operator: 'SET',
    operand: {
      id: ad_id,
      xsi_type: 'UniversalAppAd',
      videos: [
        {
          asset: { 
            xsi_type: 'YouTubeVideoAsset',
            assetName: 'TEST',
            assetSubtype: 'YOUTUBE_VIDEO',
            youTubeVideoId: 'kEVdywAtk50'
          }
        }
      ]
    }
  }
])

which produces error:

/usr/local/bundle/gems/google-ads-common-1.0.2/lib/ads_common/parameters_validator.rb:156:in `check_extra_fields': AdsCommon::Errors::UnexpectedParametersError: [:assetName, :assetSubtype, :youTubeVideoId] (AdsCommon::Errors::UnexpectedParametersError)

My next step is to investigate AppAdInfo.

Any help is highly appreciated. Thank you in advance!

Google Ads API Forum Advisor Prod

unread,
Jun 27, 2019, 11:42:45 AM6/27/19
to qw4...@gmail.com, adwor...@googlegroups.com
Hello Sama, 

Thank you for clarifying this. The AdWords API currently does not support creating new YoutubeVideoMedia, so you need to manually set the campaign's YouTube Video assets through the AdWords UI. If you already have existing youtube media in your account, you will be able to use CampaignService.mutate() to add new settings to the campaign. You will need to do a MediaService.get() to get the specific youtube media Id and then use the UniversalAppSetting to add the new media setting to the campaign. Please find the code snippet below as a reference:

UniversalAppCampaignSetting universalAppSetting = new UniversalAppCampaignSetting(); 
universalAppSetting.setYoutubeVideoMediaIds(new long[] {4390676349L}); 
campaign.setSettings(new Setting[] {universalAppSetting});

CampaignOperation operation = new CampaignOperation();
operation.setOperand(campaign);
operation.setOperator(Operator.SET);

Let me know if you have any other questions. 

Sama Ra

unread,
Jun 27, 2019, 5:12:13 PM6/27/19
to AdWords API and Google Ads API Forum
Thank you a lot for reponse and hello again!

According to your answer my first assumption was right - to manage this via CampaignService by mutating UniversalAppSetting. That works for text assets but does not for video medias:

srv = adwords.service(:CampaignService, :v201809)

srv.mutate([
  { 
    operator: 'SET',
    operand: {
      id: XXX,
      settings: [
        {
          xsi_type: 'UniversalAppCampaignSetting',

          # This works! :)
          description1: 'lalala',

          # Bit this doesn't :(
          # youtubeVideoMediaIds: [YYY],
          # youtubeVideoMediaIdsOps: ['REMOVE']
        }
      ]
    }
  }
])

I am using the latest version of ruby client for your API: google-adwords-api (1.5.0)
Is that issue related to my misunderstanding or to ruby liblary?
Hope we will fight this problem together!

Google Ads API Forum Advisor Prod

unread,
Jun 28, 2019, 10:10:01 AM6/28/19
to qw4...@gmail.com, adwor...@googlegroups.com
Hello Sama, 

Your understanding is right. The AdWords API doesn't support creating YoutubeVideoMedia so you need to manually set the campaign's YouTube Video assets through the Google Ads UI. If you already have existing youtube media in your account, you should be able use the SET operator to associate the youtube asset to the campaign using the Media Id. Please find the code sample in my previous response. 

Let me know if you have any questions.

Sama Ra

unread,
Jun 28, 2019, 12:50:06 PM6/28/19
to AdWords API and Google Ads API Forum
Need to use youtube_video_media_ids_ops and youtube_video_media_ids attribute names
Reply all
Reply to author
Forward
0 new messages