Clone a campaign using only API

790 views
Skip to first unread message

Emanuele Bragagnolo

unread,
Apr 24, 2017, 12:05:45 PM4/24/17
to AdWords API Forum
Hi

I am implementing a feature to clone a whole AdWords campaign using only the API. Basically I want the same behavior of the CTRL+C and CTRL+V that is available in the AdWords UI

with a deep copy of the campaign and of all the AdGroups contained in it.

I've found this old thread https://groups.google.com/forum/#!topic/adwords-api/rErEluYfpAQ, but it's not indicated a clear solution for this use case

My approach is to get a campaign using the CampaignService.get and then create a new campaign using the response as template and modifying only few fields

Because I want to clone the whole campaign the response should contain all the data: where can I find a complete list of fields to include in the selector of the request?


but it's is not straightforward to include the fields for the nested objects

For the moment I have some problems because I cannot get the AdGroups list in the response

Best regards, Emanuele

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Apr 24, 2017, 2:04:19 PM4/24/17
to AdWords API Forum
Hi Emanuele, 

The AdWords API does not have a clone functionality. If you want to create a copy of any object (campaign, adgroup, keyword..), you can first use the get service of that specific object and then pass the retrieved object to the mutate call of the corresponding service with the operator set as ADD. Eg., If you want to clone campaign A to create campaign B, you will first use the CampaignService.get() and retrieve all the fields of campaign A and this result will need to be passed to CampaignService.mutate(). This will only create a copy of campaign A and not the nested adgroups or criterion. To create the complete copy of campaign including the adgroups and criterion, you will need to be repeat the process in sequence using the 'get' of the respective service followed by mutate and so on. And the process will have to be repeated for all the nested objects within the campaign and the adgroup. 

To find out the adgroups under a given campaign, you could use the AdGroupService.get() with the specific CampaignId set as predicate.

Unlike AdWords web interface, there isn't a single service that copies the entire Campaign. Please let me know if have any additional questions. 

Thanks,
Sreelakshmi, AdWords API Team

Emanuele Bragagnolo

unread,
Apr 25, 2017, 9:24:48 AM4/25/17
to AdWords API Forum
Hi Sreelakshmi

Thank you for your quick reply

I have a question about this point

And the process will have to be repeated for all the nested objects within the campaign and the adgroup. 

Those nested object are only adgroups and criterion?

If no, can you give me a list of all the nested objects that are contained in a campaign and need to be copied when cloning a campaign?

Thank in advance, Emanuele

Emanuele Bragagnolo

unread,
Apr 25, 2017, 9:24:58 AM4/25/17
to AdWords API Forum
Hi Sreelakshmi

Thank you for your quick reply

I have a question about this point

And the process will have to be repeated for all the nested objects within the campaign and the adgroup. 

Those nested objects are only adgroups and criterion?

If no, can you give me a list of all the nested objects that are contained in a campaign and need to be copied when cloning a campaign?

Thank in advance, Emanuele

PS I think there are some trouble with google groups: this is the second time I create this reply

On Monday, April 24, 2017 at 8:04:19 PM UTC+2, Sreelakshmi Sasidharan (AdWords API Team) wrote:

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Apr 25, 2017, 10:57:13 AM4/25/17
to AdWords API Forum
Hi Emanuele,

The objects within a given campaign could vary on a case by case basis. They can be adgroups, keywords or other criterion at campaign or adgroup levels, ads, extensions etc. This guide should help you get an idea of the objects and its hierarchy. Please note that it is not mandatory to have all these objects in any campaign.

Emanuele Bragagnolo

unread,
Apr 25, 2017, 11:28:38 AM4/25/17
to AdWords API Forum
Hi Sreelakshmi

Ok, I understand that the campaign can contain different objects. The point is that such objects are not returned in the CampaignService.get(). To figure out which objects are contained inside a campaign I need to query for example the AdGroupService, CampaignCriterionService, AdGroupAdService filtering in the predicate for the campaignId as you suggested in the previous mail.

Now to know which services to query I need a complete list of all the different kinds of objects that can be contained in a campaign. Otherwise my "cloned" campaigns will have less objects than expected and will not be a full copy of the original

Best regards, Emanuele

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Apr 25, 2017, 4:37:14 PM4/25/17
to AdWords API Forum
Hi Emanuele, 

Unfortunately, I don't have a complete list of these dependencies. I addition to the guide on objects and its hierarchy, you could also check this section about campaign data. The AdWords API is designed in such a way that any service can only be used to create or manage that particular type of object(s). Hence, CampaignService will return data pertaining to campaign and not it's nested objects. I am afraid, there isn't a easy way as in the AdWords web interface to clone the campaign including all it's nested objects. 

An alternate option would be to clone a campaign via web interface and then check the change history to see the details of that operation. This should give you an idea about what all needs to be copied and verified once you are done with the clone.

Zweitze

unread,
Apr 26, 2017, 5:47:41 AM4/26/17
to AdWords API Forum
I think an exact duplicate campaign is rather useless, but who am I to judge. So, may I ask why you want to do this?

Some ideas I can come up with:
  • You want to change a few settings in the cloned campaign and compare the results. In that case, look at Campaign Drafts and Experiments.
  • You want to consolidate the campaigns of multiple accounts (say 8, 30 or 200 accounts) into one master account. You should contact your Google representative.
  • You want to create a snapshot every week or so, for backup purposes. Try the AdWords product forum to see what others think. Note: if you want the snapshot in the same account, again you can consider Campaign Drafts and Experiments
Also note that some things are downright impossible. For instance you cannot create a video campaign, so you can't clone one either.

Anyway, maybe it helps if you can offer the bigger picture.

Emanuele Bragagnolo

unread,
May 8, 2017, 4:15:26 AM5/8/17
to AdWords API Forum
At the moment I am doing a research to understand if copying a campaign is doable using only API: In my use case I want to clone a campaign changing only few parameters and compare the performance to the original one.

I am pretty new to AdWords system, but my idea is that copying a campaign is a normal operation: this is confirmed by the fact that this functionality is implemented in the console UI. I am only surprised that this functionality is not straightforward to implement using only API

BTW I think that I have all the informations I need. Thx to everyone

Emanuele
Reply all
Reply to author
Forward
0 new messages