Page Summary
-
A resource name is the unique identifier for an entity in the Google Ads API, represented as a string with a predictable format.
-
The
ResourceNamesutility can construct an entity's resource name if you know all its relevant IDs. -
For example, you can use the
ResourceNamesutility with the customer ID and campaign ID to construct a campaign resource name.
The unique identifier for an entity in the Google Ads API is called a resource name,
and is represented as a string with a predictable format. If you know the
constituent components of a resource name, you can use the
ResourceNames utility to generate the formatted resource
name.
ResourceNames class
The ResourceNames utility constructs the resource name of an entity when you
know all of the relevant IDs related to that entity. Pass the IDs as strings
containing digits only, without hyphens.
For example, a campaign resource name is in the format
customers/{customer_id}/campaigns/{campaign_id}. If you know the customer ID
and the campaign ID, you can use the ResourceNames utility to construct the
full resource name as follows:
use Google::Ads::GoogleAds::V25::Utils::ResourceNames;
my $customer_id = "1234567890";
my $campaign_id = "9876543210";
# Generates: "customers/1234567890/campaigns/9876543210"
my $resource_name =
Google::Ads::GoogleAds::V25::Utils::ResourceNames::campaign(
$customer_id,
$campaign_id
);
The ResourceNames utility provides similar helper methods for other entity
types, such as ad_group(), customer(), and ad_group_criterion(). Note that
ResourceNames is scoped to each supported API version namespace (such as
V25, where minor API releases like v25.1 use their
major version module V25), so replace V25 with your
target API version if using an earlier version. See the ResourceNames.pm
source file for the complete list of supported helper
methods.