I have used google ads UI to create a shopping campaign and an ad Group then product group called All products created by default.
Since google doesn't have ads API support for Node.js yet , I am finding difficult to make this work.
Here is my request sample and much appreciated if you can help on this. Please let me know if you need anything for this request.
let arr = [];
//Delete all products unit grouplet deleteRoot = {
_resource: 'AdGroupCriterion',
_operation: 'delete',
resource_name: "customers/{custID}/adGroupCriteria/{adGroupId}~{criterian}"
}
//Add root group again let addRoot = {
_resource: 'AdGroupCriterion',
_operation: 'create',
listing_group: {
type: enums.ListingGroupType.SUBDIVISION,
},
ad_group: "customers/{custID}/adGroups/{adGroupId}",
status: enums.AdGroupCriterionStatus.ENABLED,
resource_name: "customers/{custID}/adGroupCriteria/{adGroupId}~-1"
}
//Add unit node under root let addCondition = {
_resource: 'AdGroupCriterion',
_operation: 'create',
listing_group: {
type: enums.ListingGroupType.UNIT,
case_value: {
product_condition: {
}
},
parent_ad_group_criterion: "customers/{custID}/adGroupCriteria/{adGroupId}~-1"
},
ad_group: "customers/{custID}/adGroups/{adGroupId}",
status: enums.AdGroupCriterionStatus.ENABLED,
cpc_bid_micros: toMicros(0.01),
}
// Add unit node other
let addConditionOther = {
_resource: 'AdGroupCriterion',
_operation: 'create',
ad_group: "customers/{custID}/adGroups/{adGroupId}",
listing_group: {
type: enums.ListingGroupType.UNIT,
case_value: {
product_condition: {
}
},
parent_ad_group_criterion: "customers/{custID}/adGroupCriteria/{adGroupId}~-1"
},
status: enums.AdGroupCriterionStatus.ENABLED
}
//put all into an array
arr.push(deleteRoot);
arr.push(addRoot)
arr.push(addCondition);
arr.push(addConditionOther);
//execute mutate request
const response = await customer.mutateResources(arr);
Many thanks,
Vijay