How to mutate appAd

218 views
Skip to first unread message

mengqi zhu

unread,
Feb 18, 2021, 4:53:20 AM2/18/21
to AdWords API and Google Ads API Forum
Hello,

I created an appAd. I encountered a problem when I wanted to modify the ad headlines/descriptions. I read the document and said that direct modification is not supported. I need to remove it first and then recreate it to achieve the purpose of modification. But when I deleted it, I also encountered a problem, saying that "This operation is not permitted on this campaign type":

 errors {
  error_code {
    operation_access_denied_error: OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE
  }
  message: "This operation is not permitted on this campaign type"
  trigger {
    string_value: ""
  }
  location {
    field_path_elements {
      field_name: "operations"
      index: 0
    }
    field_path_elements {
      field_name: "remove"
    }
  }

My core code is as follows :
    ad_group_ad_service = client.get_service("AdGroupAdService", version="v6")
    ad_group_ad_operation = client.get_type("AdGroupAdOperation", version="v6")
    resource_name = ad_group_ad_service.ad_group_ad_path(
    customer_id, ResourceName.format_composite(ad_group_id, ad_id)
            )
    ad_group_ad_operation.remove = resource_name
    ad_group_ad_response = ad_group_ad_service.mutate_ad_group_ads(
            customer_id, [ad_group_ad_operation]
        )

How can I modify this advertisement? 
Thank you.

Google Ads API Forum Advisor Prod

unread,
Feb 18, 2021, 12:05:20 PM2/18/21
to mickey...@gmail.com, adwor...@googlegroups.com
Hello,

Thanks for reaching out. AppAds cannot be mutated -- only certain ad types may be. Please see this chart that summarizes ad type characteristics for more information.

Regards,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


ref:_00D1U1174p._5004Q2CSOPt:ref

mengqi zhu

unread,
Feb 18, 2021, 10:31:03 PM2/18/21
to AdWords API and Google Ads API Forum
Thank you for your reply,

I know that AppAd cannot be modified directly. I have read the document, and the document says "If an ad type is not mutable, it must be removed and recreated to make changes.",
So I remove first and plan to recreate again, but remove reports an error, prompting: "This operation is not permitted on this campaign type".

I want to ask, 
1. why can't it be deleted?
2. In addition, the app ads can be modified on the Google management backend, so how can I modify them using the Google Ads API?企业微信截图_70d32aa9-30a2-4931-818f-254f276ac7a1.png企业微信截图_3622821c-2619-4a3e-abf5-14f2478fc834.png

Thank you for answering again.

1. My ad details:
{
    "resourceName": "customers/7154930290/adGroupAds/116874023026~496235365387",
    "status": "ENABLED",
    "ad": {
        "type": "APP_AD",
        "appAd": {
            "headlines": [
                {
                    "text": "biaoti2"
                },
                {
                    "text": "Title 3"
                },
                {
                    "text": "biaoti1"
                },
                {
                    "text": "biaoti4"
                }
            ],
            "descriptions": [
                {
                    "text": "Advertisement Language 3"
                },
                {
                    "text": "Advertisement Language 2"
                },
                {
                    "text": "Announcement on 4"
                }
            ],
            "images": [
                {
                    "asset": "customers/7154930290/assets/12430548229"
                }
            ]
        },
        "resourceName": "customers/7154930290/ads/496235365387",
        "id": "496235365387",
        "addedByGoogleAds": false
    },
    "policySummary": {
        "reviewStatus": "REVIEW_IN_PROGRESS",
        "approvalStatus": "UNKNOWN"
    },
    "adGroup": "customers/7154930290/adGroups/116874023026"
}

2. My campaign details:
{
    "resourceName": "customers/7154930290/campaigns/12251589283",
    "status": "ENABLED",
    "adServingOptimizationStatus": "CONVERSION_OPTIMIZE",
    "advertisingChannelType": "MULTI_CHANNEL",
    "advertisingChannelSubType": "APP_CAMPAIGN",
    "networkSettings": {
        "targetGoogleSearch": true,
        "targetSearchNetwork": true,
        "targetContentNetwork": true,
        "targetPartnerSearchNetwork": false
    },
    "experimentType": "BASE",
    "servingStatus": "ENDED",
    "biddingStrategyType": "TARGET_CPA",
    "targetCpa": {
        "targetCpaMicros": "6000000"
    },
    "geoTargetTypeSetting": {
        "positiveGeoTargetType": "PRESENCE_OR_INTEREST",
        "negativeGeoTargetType": "PRESENCE"
    },
    "appCampaignSetting": {
        "biddingStrategyGoalType": "OPTIMIZE_INSTALLS_TARGET_INSTALL_COST",
        "appStore": "GOOGLE_APP_STORE",
        "appId": "com.google.android.apps.adwords"
    },
    "paymentMode": "CLICKS",
    "baseCampaign": "customers/7154930290/campaigns/12251589283",
    "name": "KOG-Android-US-UAC-210204-00C23",
    "id": "12251589283",
    "campaignBudget": "customers/7154930290/campaignBudgets/8102233149",
    "startDate": "2021-02-04",
    "endDate": "2021-02-06"

Google Ads API Forum Advisor Prod

unread,
Feb 19, 2021, 10:28:55 AM2/19/21
to mickey...@gmail.com, adwor...@googlegroups.com
Hello,

Please see my replies to your questions below:
  1. The remove operation is possible for AppAds. If you can send us the complete request and response logs associated with the operation permitted error, we can have a closer look.
  2. Editing existing AppAds is not possible using the Google Ads API. If this becomes supported, we will announce it on the Ads Developer blog.

mengqi zhu

unread,
Feb 19, 2021, 3:24:04 PM2/19/21
to AdWords API and Google Ads API Forum
Code: 

ad_group_ad_service = client.get_service("AdGroupAdService", version="v6")
ad_group_ad_operation = client.get_type("AdGroupAdOperation", version="v6")
resource_name = ad_group_ad_service.ad_group_ad_path(
  customer_id, ResourceName.format_composite(ad_group_id, ad_id)
)
ad_group_ad_operation.remove = resource_name
try:
  ad_group_ad_response = ad_group_ad_service.mutate_ad_group_ads(
    customer_id, [ad_group_ad_operation]
  )
except google.ads.google_ads.errors.GoogleAdsException as ex:
   log_proj.error(
    'Request with ID "%s" failed with status "%s" and includes the '
    "following errors:" % (ex.request_id, ex.error.code().name)
  )
  for error in ex.failure.errors:
    log_proj.error('\tError with message "%s".' % error.message)
  if error.location:
    for field_path_element in error.location.field_path_elements:
      log_proj.error("\t\tOn field: %s" % field_path_element.field_name)
    sys.exit(1)

------------
Log:

Traceback (most recent call last):
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/publish/service/googleads/get_campaigns.py", line 124, in modify_google_ad_detail
    ad_group_ad_response = ad_group_ad_service.mutate_ad_group_ads(
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/google/ads/google_ads/v6/services/ad_group_ad_service_client.py", line 313, in mutate_ad_group_ads
    return self._inner_api_calls['mutate_ad_group_ads'](request, retry=retry, timeout=timeout, metadata=metadata)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
    return wrapped_func(*args, **kwargs)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/google/api_core/retry.py", line 281, in retry_wrapped_func
    return retry_target(
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/google/api_core/retry.py", line 184, in retry_target
    return target()
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/google/api_core/timeout.py", line 214, in func_with_timeout
    return func(*args, **kwargs)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/grpc/_interceptor.py", line 216, in __call__
    response, ignored_call = self._with_call(request,
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/grpc/_interceptor.py", line 257, in _with_call
    return call.result(), call
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/grpc/_interceptor.py", line 126, in result
    raise self._exception
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/grpc/_interceptor.py", line 241, in continuation
    response, call = self._thunk(new_method).with_call(
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/grpc/_interceptor.py", line 266, in with_call
    return self._with_call(request,
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/grpc/_interceptor.py", line 257, in _with_call
    return call.result(), call
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/grpc/_interceptor.py", line 126, in result
    raise self._exception
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/grpc/_interceptor.py", line 241, in continuation
    response, call = self._thunk(new_method).with_call(
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/grpc/_interceptor.py", line 266, in with_call
    return self._with_call(request,
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/grpc/_interceptor.py", line 254, in _with_call
    call = self._interceptor.intercept_unary_unary(continuation,
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/google/ads/google_ads/interceptors/exception_interceptor.py", line 169, in intercept_unary_unary
    self._handle_grpc_failure(response)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/google/ads/google_ads/interceptors/exception_interceptor.py", line 141, in _handle_grpc_failure
    raise self._get_error_from_response(response)
google.ads.google_ads.errors.GoogleAdsException: (<_InactiveRpcError of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "Request contains an invalid argument."
        debug_error_string = "{"created":"@1613765754.151575000","description":"Error received from peer ipv4:127.0.0.1:7890","file":"src/core/lib/surface/call.cc","file_line":1063,"grpc_message":"Request contains an invalid argument.","grpc_status":3}"
>, <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "Request contains an invalid argument."
        debug_error_string = "{"created":"@1613765754.151575000","description":"Error received from peer ipv4:127.0.0.1:7890","file":"src/core/lib/surface/call.cc","file_line":1063,"grpc_message":"Request contains an invalid argument.","grpc_status":3}"
>, errors {
  error_code {
    operation_access_denied_error: OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE
  }
  message: "This operation is not permitted on this campaign type"
  trigger {
    string_value: ""
  }
  location {
    field_path_elements {
      field_name: "operations"
      index: 0
    }
    field_path_elements {
      field_name: "remove"
    }
  }
}
, 'x23hLPyacqx1Myc2XD6uCg')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/contrib/staticfiles/handlers.py", line 76, in __call__
    return self.application(environ, start_response)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
    response = self.get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/base.py", line 128, in get_response
    response = self._middleware_chain(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in __call__
    response = response or self.get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in __call__
    response = response or self.get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in __call__
    response = response or self.get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in __call__
    response = response or self.get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in __call__
    response = response or self.get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in __call__
    response = response or self.get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in __call__
    response = response or self.get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/venv-3.6/lib/python3.9/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/publish/service/modify_ad.py", line 237, in change_campaign
    modify_status(level, cam_id, new_status, type, ad_group_id)
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/publish/service/googleads/get_campaigns.py", line 195, in modify_status
    modify_google_ad_detail(ad_group_id, id, type, value, 'biaoti1')
  File "/Users/zhumengqi/workspace/fancyguo/faxing/fancy_decision/publish/service/googleads/get_campaigns.py", line 137, in modify_google_ad_detail
    sys.exit(1)
SystemExit: 1
ERROR   2021-02-20T04:15:54+0800        basehttp.py:157 basehttp.log_message()  "POST /publish/campaign/change HTTP/1.1" 500 59
Message has been deleted
Message has been deleted

mengqi zhu

unread,
Feb 21, 2021, 10:24:55 PM2/21/21
to AdWords API and Google Ads API Forum
Hello again,

Would love some more explanation about this.This problem has been bothering me for two weeks.

Thank you for all your help!

在2021年2月19日星期五 UTC+8 下午11:28:55<adsapiforumadvisor> 写道:

Google Ads API Forum Advisor Prod

unread,
Feb 22, 2021, 10:09:51 AM2/22/21
to mickey...@gmail.com, adwor...@googlegroups.com
Hello,

Thank you for providing the traceback. However, if you can provide us with the logs as outlined here, this will help us investigate the ad removal issue.

Thanks,
Message has been deleted

mengqi zhu

unread,
Feb 22, 2021, 9:45:50 PM2/22/21
to AdWords API and Google Ads API Forum

Hello, I have already provided it in the fifth email.


Code: 

ad_group_ad_service = client.get_service("AdGroupAdService", version="v6")
ad_group_ad_operation = client.get_type("AdGroupAdOperation", version="v6")
resource_name = ad_group_ad_service.ad_group_ad_path(
  customer_id, ResourceName.format_composite(ad_group_id, ad_id)
)
ad_group_ad_operation.remove = resource_name
try:
  ad_group_ad_response = ad_group_ad_service.mutate_ad_group_ads(
    customer_id, [ad_group_ad_operation]
  )
>, errors {
  error_code {
    operation_access_denied_error: OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE
  }
  message: "This operation is not permitted on this campaign type"
  trigger {
    string_value: ""
  }
  location {
    field_path_elements {
      field_name: "operations"
      index: 0
    }
    field_path_elements {
      field_name: "remove"
    }
  }
}

Google Ads API Forum Advisor Prod

unread,
Feb 23, 2021, 2:55:17 AM2/23/21
to mickey...@gmail.com, adwor...@googlegroups.com

Hello there,

Thanks for your response. I work with Matt and allow me to assist you with this.

The logs that our colleague Matt was requesting are the complete request and response logs along with the request-id, which should be generated once you have enabled logging as seen in the guide that he provided earlier. You may then provide those details via Reply privately to author option so our team could further check on our end.

Regards,

Google Logo
Mark Kevin Albios
Google Ads API Team
 

 

ref:_00D1U1174p._5004Q2CSOPt:ref

mengqi zhu

unread,
Feb 23, 2021, 4:11:08 AM2/23/21
to AdWords API and Google Ads API Forum
I'm sorry, but I don't know how to chat with you in private? Click reply author to display: “You are not authorized to reply to authors in this group”.

The following is my error log, thank you for your help.

ERROR   2021-02-23T17:03:20+0800        get_campaigns.py:138    get_campaigns.modify_google_ad_detail() Request with ID "GWcRutX8x_r4EnCvxazQIg" failed with status "INVALID_ARGUMENT" and includes the following errors:
ERROR   2021-02-23T17:03:20+0800        get_campaigns.py:143    get_campaigns.modify_google_ad_detail()         Error with message "This operation is not permitted on this campaign type".
ERROR   2021-02-23T17:03:20+0800        get_campaigns.py:146    get_campaigns.modify_google_ad_detail()                 On field: operations
ERROR   2021-02-23T17:03:20+0800        get_campaigns.py:146    get_campaigns.modify_google_ad_detail()                 On field: remove

Google Ads API Forum Advisor Prod

unread,
Feb 23, 2021, 11:09:29 AM2/23/21
to mickey...@gmail.com, adwor...@googlegroups.com
Hello,

If you are unable to reply privately, please send us an email at googleadsa...@google.com and provide a link to this forum thread in your message. If you can provide us logs as specified here, this will be help us troubleshoot the issue. 

Thanks,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


ref:_00D1U1174p._5004Q2CSOPt:ref
Reply all
Reply to author
Forward
0 new messages