บริการ DoubleClick Bid Manager
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
บริการ DoubleClick Bid Manager ช่วยให้คุณใช้
DV360 Bid Manager API
ใน Apps Script ได้ API นี้ช่วยให้เข้าถึงการรายงานของ DoubleClick Bid
Manager (DBM) แบบเป็นโปรแกรมได้
ข้อมูลอ้างอิง
ดูข้อมูลโดยละเอียดเกี่ยวกับบริการนี้ได้ที่เอกสารอ้างอิงสำหรับ DBM Reporting API เช่นเดียวกับบริการขั้นสูงทั้งหมดใน Apps
Script บริการ DoubleClick Bid Manager จะใช้ออบเจ็กต์ เมธอด และ
พารามิเตอร์เดียวกันกับ API สาธารณะ ดูข้อมูลเพิ่มเติมได้ที่วิธีกำหนดลายเซ็นของเมธอด
หากต้องการรายงานปัญหาและรับการสนับสนุนอื่นๆ โปรดดูคู่มือการสนับสนุนด้านการรายงานและการดูแลการแสดงโฆษณาของ DBM
โค้ดตัวอย่าง
ตัวอย่างโค้ดต่อไปนี้ใช้ API เวอร์ชัน 2
รับรายการคำค้นหา
ตัวอย่างนี้จะบันทึกการค้นหาทั้งหมดที่มีในบัญชี
สร้างและเรียกใช้การค้นหา
ตัวอย่างนี้สร้างและเรียกใช้การค้นหา DBM ใหม่
ดึงข้อมูลรายงานล่าสุดสำหรับคำค้นหา DBM
ตัวอย่างนี้จะดึงข้อมูลรายงานล่าสุดสำหรับคำค้นหา DBM และบันทึกเนื้อหา
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[],[],null,["# DoubleClick Bid Manager Service\n\nThe DoubleClick Bid Manager service lets you use the\n[DV360 Bid Manager API](/bid-manager)\nin Apps Script. This API provides programmatic access to DoubleClick Bid\nManager (DBM) Reporting.\n| **Note:** This is an advanced service that must be [enabled before use](/apps-script/guides/services/advanced).\n\nReference\n---------\n\nFor detailed information on this service, see the\n[reference documentation](/bid-manager/reference/rest) for the\nDBM Reporting API. Like all advanced services in Apps\nScript, the DoubleClick Bid Manager service uses the same objects, methods, and\nparameters as the public API. For more information, see [How method signatures are determined](/apps-script/guides/services/advanced#how_method_signatures_are_determined).\n\nTo report issues and find other support, see the\n[DBM Reporting and Trafficking support guide](/bid-manager/support).\n\nSample code\n-----------\n\nThe following sample code uses\n[version 2](/bid-manager/reference/rest) of the API.\n\n### Get a list of queries\n\nThis sample logs all of the queries available in the account. \nadvanced/doubleclickbidmanager.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/doubleclickbidmanager.gs) \n\n```javascript\n/**\n * Logs all of the queries available in the account.\n */\nfunction listQueries() {\n // Retrieve the list of available queries\n try {\n const queries = DoubleClickBidManager.Queries.list();\n\n if (queries.queries) {\n // Print out the ID and name of each\n for (let i = 0; i \u003c queries.queries.length; i++) {\n const query = queries.queries[i];\n console.log('Found query with ID %s and name \"%s\".',\n query.queryId, query.metadata.title);\n }\n }\n } catch (e) {\n // TODO (Developer) - Handle exception\n console.log('Failed with error: %s', e.error);\n }\n}\n```\n\n### Create and run a query\n\nThis sample creates and runs a new DBM query. \nadvanced/doubleclickbidmanager.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/doubleclickbidmanager.gs) \n\n```javascript\n/**\n * Create and run a new DBM Query\n */\nfunction createAndRunQuery() {\n let result;\n let execution;\n //We leave the default date range blank for the report run to\n //use the value defined during query creation\n let defaultDateRange = {}\n let partnerId = \"1234567\" //Replace with your Partner ID\n let query = {\n \"metadata\": {\n \"title\": \"Apps Script Example Report\",\n \"dataRange\": {\n \"range\": \"YEAR_TO_DATE\"\n },\n \"format\": \"CSV\"\n },\n \"params\": {\n \"type\": \"STANDARD\",\n \"groupBys\": [\n \"FILTER_PARTNER\",\n \"FILTER_PARTNER_NAME\",\n \"FILTER_ADVERTISER\",\n \"FILTER_ADVERTISER_NAME\",\n ],\n \"filters\": [\n {\"type\": \"FILTER_PARTNER\",\"value\": partnerId}\n ],\n \"metrics\": [\n \"METRIC_IMPRESSIONS\"\n ]\n },\n \"schedule\": {\n \"frequency\": \"ONE_TIME\"\n }\n }\n\n try {\n result = DoubleClickBidManager.Queries.create(query);\n if (result.queryId) {\n console.log('Created query with ID %s and name \"%s\".',\n result.queryId, result.metadata.title);\n execution = DoubleClickBidManager.Queries.run(defaultDateRange, result.queryId);\n if(execution.key){\n console.log('Created query report with query ID %s and report ID \"%s\".',\n execution.key.queryId, execution.key.reportId);\n }\n }\n } catch (e) {\n // TODO (Developer) - Handle exception\n console.log(e)\n console.log('Failed with error: %s', e.error);\n }\n}\n```\n\n### Fetch the most recent report for a DBM query\n\nThis sample fetches the most recent report for a DBM query and logs the content. \nadvanced/doubleclickbidmanager.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/doubleclickbidmanager.gs) \n\n```javascript\n/**\n * Fetches a report file\n */\nfunction fetchReport() {\n const queryId = '1234567'; // Replace with your query ID.\n const orderBy = \"key.reportId desc\";\n\n try {\n const report = DoubleClickBidManager.Queries.Reports.list(queryId, {orderBy:orderBy});\n if(report.reports){\n const firstReport = report.reports[0];\n if(firstReport.metadata.status.state == 'DONE'){\n const reportFile = UrlFetchApp.fetch(firstReport.metadata.googleCloudStoragePath)\n console.log(\"Printing report content to log...\")\n console.log(reportFile.getContentText())\n }\n else{\n console.log(\"Report status is %s, and is not available for download\", firstReport.metadata.status.state)\n }\n }\n\n } catch (e) {\n // TODO (Developer) - Handle exception\n console.log(e)\n console.log('Failed with error: %s', e.error);\n }\n}\n```"]]