How to edit an ad through adwords api in a correct way?

49 views
Skip to first unread message

Justinas Ringaila

unread,
Mar 8, 2016, 4:22:58 PM3/8/16
to AdWords API Forum
Hi,
I'm trying to edit ad. According to your documentation https://developers.google.com/adwords/api/docs/reference/v201601/AdGroupAdService.Ad it is not possible to do so.
As it was stated there I need to remove the ad and add new one

Despite the fact I tried to do it in this way;
            AdGroupAd textAdGroupAd = new AdGroupAd();
            textAdGroupAd.adGroupId = adGroupId; //Id of existing ad group
            textAdGroupAd.ad = textAd; //Id of  existing ad that I want to be altered

            // Create the operation.
            AdGroupAdOperation operation = new AdGroupAdOperation();
            operation.@operator = Operator.SET;
            operation.operand = textAdGroupAd;

And actually it was a success. In history I see that the ad was removed and added a new one. As I understood the removal process was made under the hood.
Is it ok to do so? Or I'm misusing the API?

Thanet Knack Praneenararat (AdWords API Team)

unread,
Mar 8, 2016, 9:40:35 PM3/8/16
to AdWords API Forum
Hi Justinas,

Yes, SET operation for AdGroupAdService is supposed to use for changing the status of ads only.
If you omit the setting of status, [RequiredError.REQUIRED @ operations[0].operand.status] should be thrown.

If you happen to be able to set other fields, like displayUrl or finalUrls, could you please send the SOAP logs to us via Reply privately to author?

Cheers,
Thanet, AdWords API Team

Justinas Ringaila

unread,
Mar 9, 2016, 4:36:13 AM3/9/16
to AdWords API Forum

Strangely I was not able to reproduce it today.... By the way any suggestions how remove and create ads without risking to loose any kind of data? I'm trying to set trackingUrlTemplate

Thanet Knack Praneenararat (AdWords API Team)

unread,
Mar 9, 2016, 4:42:02 AM3/9/16
to adwor...@googlegroups.com
Hello Justinas,

As you've mentioned, ads can be created and removed only. They cannot be modified via SET (except for their statuses).
Once your ads are removed and created, all your stats belonging to those ads will not go to the new ads.
However, you can still access those old ads' stats by specifying the predicate STATUS = DISABLED in case of reporting.

Cheers,
Thanet, AdWords API Team
Reply all
Reply to author
Forward
Message has been deleted
0 new messages