Dịch vụ DoubleClick Bid Manager
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Dịch vụ Trình quản lý giá thầu của DoubleClick cho phép bạn sử dụng DV360 Bid Manager API trong Apps Script. API này cung cấp quyền truy cập theo phương pháp có lập trình vào Báo cáo của Trình quản lý giá thầu của DoubleClick (DBM).
Tài liệu tham khảo
Để biết thông tin chi tiết về dịch vụ này, hãy xem tài liệu tham khảo cho DBM Reporting API. Giống như tất cả các dịch vụ nâng cao trong Apps Script, dịch vụ DoubleClick Bid Manager sử dụng cùng các đối tượng, phương thức và tham số như API công khai. Để biết thêm thông tin, hãy xem bài viết Cách xác định chữ ký phương thức.
Để báo cáo vấn đề và tìm thông tin hỗ trợ khác, hãy xem Hướng dẫn hỗ trợ về Báo cáo và Phân phối của DBM.
Mã mẫu
Mã mẫu sau đây sử dụng phiên bản 2 của API.
Lấy danh sách các truy vấn
Mẫu này ghi lại tất cả các truy vấn có trong tài khoản.
Tạo và chạy truy vấn
Mẫu này tạo và chạy một truy vấn DBM mới.
Tìm nạp báo cáo gần đây nhất cho một truy vấn DBM
Mẫu này tìm nạp báo cáo gần đây nhất cho một truy vấn DBM và ghi lại nội dung.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-31 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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```"]]