อัลกอริทึมการเสนอราคาที่กําหนดเองสร้างขึ้นจากตรรกะการเสนอราคาที่ผู้ใช้กําหนด กำหนดโฆษณาไปยังรายการโฆษณาผ่านกลยุทธ์การเสนอราคา เมื่อเสนอราคาสำหรับพื้นที่โฆษณา รายการโฆษณาจะใช้ตรรกะที่กำหนดเองนั้น
ก่อนอื่น ให้เลือกประเภทอัลกอริทึมและสร้างทรัพยากรอัลกอริทึม
เลือกประเภทอัลกอริทึมการเสนอราคาที่กําหนดเอง
ประเภทอัลกอริทึมจะกำหนดวิธีที่ตรรกะการเสนอราคาจะกำหนดไว้ในอัลกอริทึม
เลือกประเภทใดประเภทหนึ่งต่อไปนี้ที่สร้างผ่าน Display & Video 360 API ได้
SCRIPT_BASED: ตรรกะที่ตั้งค่าโดยสคริปต์ที่อัปโหลด สคริปต์เป็น ไฟล์ข้อความที่ใช้ไวยากรณ์ Python พื้นฐานRULE_BASED: ตรรกะที่กำหนดโดยชุดกฎที่อัปโหลด ชุดกฎคือไฟล์ JSONAlgorithmRulesที่อัปโหลด
สร้างทรัพยากร CustomBiddingAlgorithm
ใช้คำขอ create เพื่อสร้างอัลกอริทึมการเสนอราคาที่กำหนดเอง
ผู้ลงโฆษณาหรือพาร์ทเนอร์อาจเป็นownerของอัลกอริทึมก็ได้ หากเป็นของเจ้าของโฆษณา จะใช้ได้เฉพาะแคมเปญโฆษณาภายใต้ผู้ลงโฆษณารายนั้นเท่านั้น หากเป็นของพาร์ทเนอร์ ผู้ลงโฆษณาจะใช้ได้เฉพาะกับผู้ลงโฆษณาที่พาร์ทเนอร์ตั้งใจแชร์ด้วยเท่านั้น
วิธีสร้างอัลกอริทึมการเสนอราคาที่กำหนดเองมีดังนี้
Java
// Provide the ID of the advertiser that will own the algorithm. long advertiserId = advertiser-id; // Provide the display name of the algorithm. String displayName = display-name; // Provide the type of custom bidding algorithm. String customBiddingAlgorithmType = custom-bidding-algorithm-type; // Create the custom bidding algorithm structure. CustomBiddingAlgorithm algorithm = new CustomBiddingAlgorithm() .setAdvertiserId(advertiserId) .setDisplayName(displayName) .setEntityStatus("ENTITY_STATUS_ACTIVE") .setCustomBiddingAlgorithmType(customBiddingAlgorithmType); // Create the algorithm. CustomBiddingAlgorithm response = service.customBiddingAlgorithms().create(algorithm).execute(); // Display the new custom bidding algorithm ID. System.out.printf( "Custom Bidding Algorithm was created with the ID %s.", response.getCustomBiddingAlgorithmId());
Python
# Provide the ID of the advertiser that will own the algorithm. advertiser_id = advertiser-id # Provide the display name of the algorithm. display_name = display-name # Provide the type of custom bidding algorithm. custom_bidding_algo_type = custom-bidding-algorithm-type # Build CustomBiddingAlgorithm object. custom_bidding_algorithm_obj = { "advertiserId": advertiser_id, "displayName": display_name, "entityStatus": "ENTITY_STATUS_ACTIVE", "customBiddingAlgorithmType": custom_bidding_algo_type, } # Build and execute request. algorithm_response = ( service.customBiddingAlgorithms() .create(body=custom_bidding_algorithm_obj) .execute() ) # Print ID of new custom bidding algorithm. print( "Custom bidding algorithm was created with ID " f'{algorithm_response["customBiddingAlgorithmId"]}.' )
PHP
// Provide the ID of the advertiser that will own the algorithm. $advertiserId = advertiser-id; // Provide the display name of the algorithm. $displayName = display-name; // Provide the type of custom bidding algorithm. $customBiddingAlgorithmType = custom-bidding-algorithm-type; // Create the custom bidding algorithm structure. $algorithm = new Google_Service_DisplayVideo_CustomBiddingAlgorithm(); $algorithm->setAdvertiserId($advertiserId); $algorithm->setDisplayName($displayName); $algorithm->setEntityStatus('ENTITY_STATUS_ACTIVE'); $algorithm->setCustomBiddingAlgorithmType($customBiddingAlgorithmType); // Call the API, creating the advertiser. try { $result = $this->service->customBiddingAlgorithms->create($algorithm); } catch (\Exception $e) { $this->renderError($e); return; } // Print ID of new custom bidding algorithm. printf('<p>Custom Bidding Algorithm was created with the ID %s.</p>', $result['customBiddingAlgorithmId']);