New campaign ids from change history

116 views
Skip to first unread message

Eshwar Chettri

unread,
Mar 8, 2017, 8:23:40 AM3/8/17
to AdWords API Forum
Hi,

  I want to know that how can i get campaign ids of newly added campaign in adwords using API from change history.

eshwar.

Vishal Vinayak (Adwords API Team)

unread,
Mar 8, 2017, 2:46:59 PM3/8/17
to AdWords API Forum
Hi Eshwar,

CustomerSyncService can be used to fetch recent changes to an account or a campaign for a given date range. Please refer to this example in Java to fetch changes to all campaigns in your account. For newly created campaigns, CampaignChangeData.campaignChangeStatus would return the value 'NEW'. Same example is available in other client libraries as well. Please revert if you have additional questions or concerns.

Regards,
Vishal, AdWords API Team

Eshwar Chettri

unread,
Mar 9, 2017, 2:13:51 AM3/9/17
to AdWords API Forum
Hi vishal,
  Can you please provide the reference code for getting the campaign Ids of newly added campaign in adwords and existing campaign changed .

Regards,
 Eshwar.

Vishal Vinayak (Adwords API Team)

unread,
Mar 9, 2017, 2:55:52 PM3/9/17
to AdWords API Forum
Hi Eshwar,

Unfortunately, using CustomerSyncService, you cannot fetch only the changed campaigns directly. The best way to achieve this is by following this example and checking for CampaignChangeData.campaignChangeStatus value = 'NEW'. As an alternative, you can download the Campaign Performance Report and filter on StartDate. Please revert if you have additional questions or concerns.

Eshwar Chettri

unread,
Mar 13, 2017, 4:38:43 AM3/13/17
to AdWords API Forum
Hi Vishal,
 using CustomerSyncService, only the campaignIds of those campaigns which are enabled or paused are retriving, But i want all the campaiIds including campaignId of removed campaigns from adwords.   
  Thanks,
Eshwar


On Wednesday, March 8, 2017 at 6:53:40 PM UTC+5:30, Eshwar Chettri wrote:

Vishal Vinayak (Adwords API Team)

unread,
Mar 13, 2017, 11:34:38 AM3/13/17
to AdWords API Forum
Hi Eshwar,

Technically, you can filter only the removed campaigns in the get call to CampaignService and pass the list of removed campaignIds to your CustomerSyncSelector.

SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
        .fields(CampaignField.Id, CampaignField.Name)
        .equals(CampaignField.Status, "REMOVED".toString())
        .build();
CampaignPage campaigns = campaignService.get(selector);

If there were any recent changes made to the campaign, those changes will be available even after removing the campaign. For example, I added a criterion to a campaign and then deleted the campaign but I was still able to fetch the changes after the campaign was removed (campaign IDs were changed to random numbers). 

Before Removing:
Campaign with ID 123456789 was changed:
Campaign changed status: 'FIELDS_CHANGED'
Added campaign criteria: {1003,264467738550}
Removed campaign criteria: {}

After Removing:
Campaign with ID 123456789 was changed:
Campaign changed status: 'FIELDS_CHANGED'
Added campaign criteria: {1003,264467738550}
Removed campaign criteria: {}

Hope this helps. Please revert if you have additional questions.

Eshwar Chettri

unread,
Mar 14, 2017, 1:06:18 AM3/14/17
to AdWords API Forum
Hi Vishal,
  Thank you for response, You mean to say that we cannot get campaign ids of both existing and removed campaigns at a time. And we need to send separate request for existing and removed campaigns.
 Thanks,
Eswhar


On Wednesday, March 8, 2017 at 6:53:40 PM UTC+5:30, Eshwar Chettri wrote:

Vishal Vinayak (Adwords API Team)

unread,
Mar 14, 2017, 11:04:36 AM3/14/17
to AdWords API Forum
Hi Eshwar,

You can also filter multiple campaign status types by using the .in predicate instead of the .equals predicate as follows:

Selector selector = builder
        .fields(CampaignField.Id, CampaignField.Name)
        .in(CampaignField.Status, "REMOVED" , "ENABLED", "PAUSED")
        .build();
Reply all
Reply to author
Forward
0 new messages