Thuật toán đặt giá thầu tuỳ chỉnh được tạo từ logic đặt giá thầu do người dùng xác định. Gán quảng cáo cho một mục hàng thông qua chiến lược giá thầu của mục hàng đó. Khi đặt giá thầu cho khoảng không quảng cáo, mục hàng sẽ sử dụng logic tuỳ chỉnh đó.
Trước tiên, hãy chọn một loại thuật toán và tạo tài nguyên thuật toán.
Chọn một loại Thuật toán đặt giá thầu tuỳ chỉnh
Loại thuật toán quy định cách xác định logic đặt giá thầu trong thuật toán.
Chọn một trong các loại sau đây có thể được tạo thông qua Display & Video 360 API:
SCRIPT_BASED: Logic do tập lệnh được tải lên thiết lập. Tập lệnh này là một tệp văn bản sử dụng cú pháp Python cơ bản.RULE_BASED: Logic do một bộ quy tắc được tải lên thiết lập. Bộ quy tắc là một tệp JSONAlgorithmRulesđược tải lên.
Tạo tài nguyên CustomBiddingAlgorithm
Sử dụng yêu cầu create để tạo một thuật toán đặt giá thầu tuỳ chỉnh.
Nhà quảng cáo hoặc đối tác đều có thể là owner của một thuật toán. Nếu thuộc quyền sở hữu của một nhà quảng cáo, thì chỉ các chiến dịch quảng cáo thuộc nhà quảng cáo đó mới có thể sử dụng. Nếu thuộc quyền sở hữu của một đối tác, thì chỉ những nhà quảng cáo mà đối tác chủ ý chia sẻ phân khúc đó mới có thể sử dụng.
Sau đây là cách tạo thuật toán đặt giá thầu tuỳ chỉnh:
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']);