Ein Algorithmus für die benutzerdefinierte Gebotseinstellung wird aus der von dem Nutzer definierten Gebotslogik erstellt. Sie können ihn einer Werbebuchung über die Gebotsstrategie zuweisen. Wenn für Anzeigeninventar geboten wird, verwendet die Werbebuchung diese benutzerdefinierte Logik.
Wählen Sie zuerst einen Algorithmustyp aus und erstellen Sie die Algorithmus ressource.
Algorithmustyp für die benutzerdefinierte Gebotseinstellung auswählen
Der Algorithmustyp bestimmt, wie die Gebotslogik im Algorithmus definiert wird.
Wählen Sie einen der folgenden Typen aus, die über die Display &Video 360 API erstellt werden können:
SCRIPT_BASED: Logik, die durch ein hochgeladenes Skript festgelegt wird. Das Skript ist eine Textdatei mit grundlegender Python-Syntax.RULE_BASED: Logik, die durch ein hochgeladenes Regelset festgelegt wird. Das Regelset ist eine hochgeladeneAlgorithmRulesJSON-Datei.
Ressource erstellenCustomBiddingAlgorithm
Verwenden Sie eine create-Anfrage, um einen Algorithmus für die benutzerdefinierte Gebotseinstellung zu erstellen.
Der owner eines
Algorithmus kann entweder ein Werbetreibender oder ein Partner sein. Wenn der Algorithmus einem Werbetreibenden gehört, kann er nur für Werbekampagnen dieses Werbetreibenden verwendet werden. Wenn er einem Partner gehört, kann er nur von Werbetreibenden verwendet werden, für die er
freigegeben wurde.
So erstellen Sie einen Algorithmus für die benutzerdefinierte Gebotseinstellung:
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']);