Özel teklif verme algoritması, kullanıcı tarafından tanımlanan teklif verme mantığına göre oluşturulur. Teklif stratejisi aracılığıyla bir satır öğesine atayın. Satır öğesi, reklam envanterine teklif verirken bu özel mantığı kullanır.
Öncelikle bir algoritma türü seçin ve algoritma kaynağını oluşturun.
Özel teklif verme algoritması türü seçme
Algoritma türü, teklif verme mantığının algoritma içinde nasıl tanımlandığını belirler.
Display & Video 360 API ile oluşturulabilen aşağıdaki türlerden birini seçin:
SCRIPT_BASED: Yüklenen bir komut dosyası tarafından belirlenen mantık. Komut dosyası, temel Python söz dizimini kullanan bir metin dosyasıdır.RULE_BASED: Yüklenen bir kural grubu tarafından belirlenen mantık. Kural grubu, yüklenen birAlgorithmRulesJSON dosyasıdır.
CustomBiddingAlgorithm kaynağı oluşturma
Özel teklif verme algoritması oluşturmak için create isteği kullanın.
Bir algoritmanın owner reklamveren veya iş ortağı olabilir. Bir reklamverene aitse yalnızca bu reklamverenin altındaki reklam kampanyaları tarafından kullanılabilir. Bir iş ortağına aitse yalnızca kasıtlı olarak paylaşıldığı reklamverenler tarafından kullanılabilir.
Özel teklif verme algoritması oluşturma adımları:
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']);