ชื่อทรัพยากร
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ยูทิลิตี
ResourceNames
เป็นวิธีสร้างชื่อทรัพยากรของเอนทิตีหากคุณทราบรหัสที่เกี่ยวข้องทั้งหมดของเอนทิตีนั้น
เช่น ชื่อทรัพยากรแคมเปญ
อยู่ในรูปแบบ customers/<CUSTOMER_ID>/campaigns/<CAMPAIGN_ID>
ดังนั้นหากคุณ
ทราบรหัสลูกค้าและรหัสแคมเปญ คุณจะใช้ยูทิลิตี ResourceNames
เพื่อสร้างชื่อทรัพยากรแบบเต็มได้
หาก $customerId
มีรหัสลูกค้าและ $campaignId
มีรหัสแคมเปญ คุณจะใช้
forCampaign
เพื่อรับชื่อทรัพยากรของแคมเปญได้ดังที่แสดงด้านล่าง
$campaignResourceName = ResourceNames::forCampaign($customerId, $campaignId)
แต่ละเอนทิตีมีชุดรหัสที่แตกต่างกันซึ่งประกอบกันเป็นชื่อทรัพยากร เช่น ชื่อทรัพยากรของเกณฑ์กลุ่มโฆษณาต้องมีรหัสลูกค้า รหัสกลุ่มโฆษณา และรหัสเกณฑ์กลุ่มโฆษณา
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-27 UTC
[null,null,["อัปเดตล่าสุด 2025-08-27 UTC"],[[["\u003cp\u003eThe \u003ccode\u003eResourceNames\u003c/code\u003e utility helps build resource names for Google Ads entities using their respective IDs.\u003c/p\u003e\n"],["\u003cp\u003eYou need to provide the necessary IDs, like customer ID and campaign ID, to construct a specific resource name.\u003c/p\u003e\n"],["\u003cp\u003eEach Google Ads entity type has a unique set of IDs required for its resource name, such as ad group criteria needing customer ID, ad group ID, and criterion ID.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eResourceNames\u003c/code\u003e offers functions like \u003ccode\u003eforCampaign\u003c/code\u003e to easily generate resource names for specific entities.\u003c/p\u003e\n"]]],[],null,["# Resource Names\n\nThe\n[ResourceNames](https://github.com/googleads/google-ads-php/blob/HEAD/src/Google/Ads/GoogleAds/Util/V21/ResourceNames.php)\nutility is a way to construct the resource name of an entity if you know all of\nthe relevant IDs related to that entity. For example, a campaign resource name\nis in the format `customers/\u003cCUSTOMER_ID\u003e/campaigns/\u003cCAMPAIGN_ID\u003e`, so if you\nknow the customer ID and the campaign ID, you can use the `ResourceNames`\nutility to construct the full resource name.\n\nProvided that `$customerId` contains your customer ID and `$campaignId` contains\nyour campaign ID, you can use\n[forCampaign](https://github.com/googleads/google-ads-php/blob/HEAD/src/Google/Ads/GoogleAds/Util/V21/ResourceNames.php#L141)\nto get the resource name of the campaign as shown below: \n\n $campaignResourceName = ResourceNames::forCampaign($customerId, $campaignId)\n\nEach entity has a different set of IDs that composes the resource name. For\ninstance, the resource name of an ad group criterion needs a customer ID, ad\ngroup ID, and ad group criterion ID."]]