Asset Group

46 views
Skip to first unread message

Tanish Gupta

unread,
Nov 23, 2023, 3:31:31 AM11/23/23
to Google Ads API and AdWords API Forum
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

Google Ads API Forum Advisor

unread,
Nov 23, 2023, 10:30:43 AM11/23/23
to tanish.gupta....@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

By reviewing your concern, I understand that you are unsure about how to retrieve the assetgroupresourceName in the Google Ads API. Could you kindly share a UI screenshot of your Google Ads account, highlighting the assetgroupresourceName field that you intend to retrieve through the API?

You can send the details via Reply privately to the author option, or direct private reply to this email.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02qUeon:ref"

Thanks,
 
Google Logo Google Ads API Team
​​​​​​​

Reply all
Reply to author
Forward
0 new messages