Hi
I am confused in how to get assetgroupresourceName in this function
/** Creates a list of MutateOperations that create a new AssetGroup. */
private List<MutateOperation> createAssetGroupOperations(
long customerId,
String assetGroupResourceName,
List<String> headlineAssetResourceNames,
List<String> descriptionAssetResourceNames)
throws IOException {
List<MutateOperation> mutateOperations = new ArrayList<>();
String campaignResourceName =
ResourceNames.campaign(customerId,
PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID);
// Creates the AssetGroup.
AssetGroup assetGroup =
AssetGroup.newBuilder()
.setName("Performance Max asset group #" + getPrintableDateTime())
.setCampaign(campaignResourceName)
.addFinalUrls("
http://www.example.com")
.addFinalMobileUrls("
http://www.example.com")
.setStatus(AssetGroupStatus.PAUSED)
.setResourceName(assetGroupResourceName)
.build();
AssetGroupOperation assetGroupOperation =
AssetGroupOperation.newBuilder().setCreate(assetGroup).build();
mutateOperations.add(
MutateOperation.newBuilder().setAssetGroupOperation(
assetGroupOperation).build());
// For the list of required assets for a Performance Max campaign, see
//
https://developers.google.com/google-ads/api/docs/performance-max/assets
// An AssetGroup is linked to an Asset by creating a new AssetGroupAsset
// and providing:
// the resource name of the AssetGroup
// the resource name of the Asset
// the field_type of the Asset in this AssetGroup.
// To learn more about AssetGroups, see
//
https://developers.google.com/google-ads/api/docs/performance-max/asset-groups
// Links the previously created multiple text assets.
// Links the headline assets.
for (String resourceName : headlineAssetResourceNames) {
AssetGroupAsset assetGroupAsset =
AssetGroupAsset.newBuilder()
.setFieldType(AssetFieldType.HEADLINE)
.setAssetGroup(assetGroupResourceName)
.setAsset(resourceName)
.build();
AssetGroupAssetOperation assetGroupAssetOperation =
AssetGroupAssetOperation.newBuilder().setCreate(assetGroupAsset).
build();
mutateOperations.add(
MutateOperation.newBuilder()
.setAssetGroupAssetOperation(assetGroupAssetOperation)
.build());
}
// Links the description assets.
for (String resourceName : descriptionAssetResourceNames) {
AssetGroupAsset assetGroupAsset =
AssetGroupAsset.newBuilder()
.setFieldType(AssetFieldType.DESCRIPTION)
.setAssetGroup(assetGroupResourceName)
.setAsset(resourceName)
.build();
AssetGroupAssetOperation assetGroupAssetOperation =
AssetGroupAssetOperation.newBuilder().setCreate(assetGroupAsset).
build();
mutateOperations.add(
MutateOperation.newBuilder()
.setAssetGroupAssetOperation(assetGroupAssetOperation)
.build());
}
// Creates and links the long headline text asset.
List<MutateOperation> createAndLinkTextAssetOperations =
createAndLinkTextAsset(customerId, "Travel the World", AssetFieldType.
LONG_HEADLINE);
mutateOperations.addAll(createAndLinkTextAssetOperations);
// Creates and links the business name text asset.
createAndLinkTextAssetOperations =
createAndLinkTextAsset(customerId, "Interplanetary Cruises",
AssetFieldType.BUSINESS_NAME);
mutateOperations.addAll(createAndLinkTextAssetOperations);
// Creates and links the image assets.
// Creates and links the Logo Asset.
createAndLinkTextAssetOperations =
createAndLinkImageAsset(
customerId, "
https://gaagl.page.link/bjYi", AssetFieldType.LOGO, "Marketing
Logo");
mutateOperations.addAll(createAndLinkTextAssetOperations);
// Creates and links the Marketing Image Asset.
createAndLinkTextAssetOperations =
createAndLinkImageAsset(
customerId,
"
https://gaagl.page.link/Eit5",
AssetFieldType.MARKETING_IMAGE,
"Marketing Image");
mutateOperations.addAll(createAndLinkTextAssetOperations);
// Creates and links the Square Marketing Image Asset.
createAndLinkTextAssetOperations =
createAndLinkImageAsset(
customerId,
"
https://gaagl.page.link/bjYi",
AssetFieldType.SQUARE_MARKETING_IMAGE,
"Square Marketing Image");
mutateOperations.addAll(createAndLinkTextAssetOperations);
return mutateOperations;
}
Thanks
Tanish