Display & Video 360 API를 사용하여 맞춤 입찰 구현을 관리할 수 있습니다. 맞춤 입찰 알고리즘을 만들고, 개별 스크립트를 업로드 및 확인하고, 특정 알고리즘을 리소스의 입찰 전략으로 할당할 수 있습니다.
이 페이지에서는 Display &Video 360 API를 사용하여 맞춤 입찰 알고리즘을 만들고, 업데이트하고, 할당하는 방법을 설명합니다. 각 섹션에서는 코드 샘플을 제공합니다.
맞춤 입찰 알고리즘 만들기
A CustomBiddingAlgorithm 객체는 입찰 전략에 사용할 수 있도록 광고 항목에 할당할 수 있는 개별
알고리즘을 나타냅니다. 이
객체에는
customBiddingAlgorithmType,
entityStatus 및
customBiddingAlgorithmState과 같은 알고리즘에 관한 세부정보가 포함되어 있습니다. 알고리즘이 사용할
CustomBiddingScript 객체를 하위 리소스로 만들 수 있습니다.
다음은 스크립트 기반 맞춤 입찰 알고리즘을 만드는 방법의 예입니다.
Python
# Create a custom bidding algorithm object. custom_bidding_algorithm_obj = { 'advertiserId': advertiser-id, 'displayName': display-name, 'entityStatus': 'ENTITY_STATUS_ACTIVE', 'customBiddingAlgorithmType': 'SCRIPT_BASED' } # Create the custom bidding algorithm. response = service.customBiddingAlgorithms().create( body=algorithm_obj ).execute() # Display the new custom bidding algorithm. print(f'The following Custom Bidding Algorithm was created: {response}')
알고리즘 액세스 관리
맞춤 입찰 알고리즘은 파트너 또는 광고주가 소유할 수 있습니다. 파트너가 소유한 알고리즘은 해당 파트너와 하위 광고주가 sharedAdvertiserIds 필드에 나열된 광고주가 액세스하고 수정할 수 있습니다.
광고주가 소유한 알고리즘은 해당 광고주와 상위 파트너가 액세스하고 수정할 수 있지만 다른 광고주와 공유할 수는 없습니다.
단일 광고주에만 알고리즘을 사용하는 경우
광고주를 advertiserId 필드를 사용하여 소유자로 할당합니다.
그렇지 않은 경우
partnerId 필드를 사용하여 광고주의 상위 파트너를 소유자로 할당하고
sharedAdvertiserIds 필드를 사용하여 광고주에게 액세스 권한을 부여합니다.
스크립트 업로드
맞춤 입찰 알고리즘을 만든 후에는 해당 알고리즘이 사용할 스크립트를 만듭니다. 스크립트 기반 맞춤 입찰 알고리즘은 사용자 제공 스크립트를 사용하여 노출의 가치를 평가합니다. 간단한 스크립트 샘플과 고급 필드 목록은 Display & Video 360 고객센터를 통해 확인할 수 있습니다.
다음 섹션에서는 맞춤 입찰 알고리즘에 새 스크립트 또는 업데이트된 스크립트를 추가하는 방법을 설명합니다.
스크립트 리소스 위치 검색
먼저
알고리즘 리소스에서 사용 가능한 리소스 위치를
customBiddingAlgorithms.uploadScript 메서드를 사용하여 검색합니다. 이
요청은 CustomBiddingScriptRef 객체를 리소스 이름
과 함께 반환합니다. 리소스 이름에 지정된 위치에 스크립트 파일을
업로드할 수 있습니다. 그런 다음 맞춤 입찰 스크립트 참조 객체를 사용하여
스크립트 리소스를 만듭니다.
다음은 사용 가능한 리소스 위치를 검색하는 방법의 예입니다.
Python
# Retrieve a usable custom bidding script reference # object. custom_bidding_script_ref = service.customBiddingAlgorithms().uploadScript( customBiddingAlgorithmId=custom-bidding-algorithm-id, advertiserId=advertiser-id ).execute() # Display the new custom bidding script reference object. print('The following custom bidding script reference object was retrieved:' f'{custom_bidding_script_ref}')
스크립트 파일 업로드
사용 가능한 리소스 위치를 검색한 후에는
해당 위치에 스크립트 파일을 업로드합니다. Display & Video 360 시스템에서
media.upload 메서드를 사용합니다. 이 메서드는 쿼리 매개변수
uploadType=media가 필요한
간단한 업로드를 지원합니다.
다음은 검색된 맞춤 입찰 스크립트 참조 객체가 주어졌을 때 스크립트 파일을 업로드하는 방법의 예입니다.
Python
# Create a media upload object. media = MediaFileUpload(script-path) # Create upload request. upload_request = service.media().upload( resourceName=resource-name, media_body=media) # Override response handler to expect null response. upload_request.postproc = HttpRequest.null_postproc # Upload script to resource location given in retrieved custom bidding # script reference object. upload_request.execute()
스크립트 객체 만들기
스크립트 파일이 업로드되면
customBiddingAlgorithms.scripts.create 메서드를 사용하여 맞춤 입찰 스크립트 리소스를 만듭니다. 요청에 전달된
CustomBiddingScript 객체에는
CustomBiddingScriptRef 객체만 script 필드의 할당된
값으로 포함되어야 합니다. 이렇게 하면 업로드된 스크립트 파일이 새 스크립트 리소스와 연결됩니다.
다음은 스크립트 파일을 만드는 방법의 예입니다.
Python
# Create a custom bidding script object. script_obj = { 'script': custom-bidding-script-ref } # Create the custom bidding script. response = service.customBiddingAlgorithms().scripts().create( customBiddingAlgorithmId=custom-bidding-algorithm-id, advertiserId=advertiser-id, body=script_obj).execute() # Display the new custom bidding script object. print(f'The following custom bidding script was created: {response}')
맞춤 입찰 스크립트 리소스를 만들면 Display &Video 360에서 스크립트를 처리하여 노출에 점수를 매기는 데 스크립트를 성공적으로 사용할 수 있도록 합니다.
스크립트 객체의
state 필드를 통해 이 처리 상태를 검색합니다. 새 스크립트가 수락되면 맞춤 입찰 알고리즘에서 스크립트를 사용하여 노출 값에 점수를 매기기 시작합니다. 이 작업은 즉시 실행되므로 새 스크립트 리소스를 만들기 전에 알고리즘을 업데이트할지 확인하세요.
맞춤 입찰 알고리즘 할당
맞춤 입찰 알고리즘을 만들고, 수락된 스크립트를 업로드하고, 필요한 요구사항 을 충족한 후에는 맞춤 입찰 알고리즘을 광고 항목 또는 삽입 주문의 입찰 전략에 할당할 수 있습니다.
맞춤 입찰 알고리즘 ID를 각각
performanceGoalType 및
customBiddingAlgorithmId 필드에 할당하여
지출 극대화 및
실적 목표 입찰 전략에서 맞춤 입찰 알고리즘을 사용할 수 있습니다.BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO
입찰 전략에 따라 다른 입찰 매개변수를 사용할 수 있거나 필요할 수 있습니다.
다음은 지정된 맞춤 입찰 알고리즘으로 지출 극대화 입찰 전략을 사용하도록 광고 항목을 업데이트하는 방법의 예입니다.
Python
# Create the new bid strategy object. bidding_strategy = { 'maximizeSpendAutoBid': { 'performanceGoalType': 'BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO', 'customBiddingAlgorithmId': custom-bidding-algorithm-id } } # Create a line item object assigning the new bid strategy. line_item_obj = {'bidStrategy': bidding_strategy} # Update the line item with a new bid strategy. response = service.advertisers().lineItems().patch( advertiserId=advertiser-id, lineItemId=line-item-id, updateMask='bidStrategy', body=line_item_obj).execute() # Display the line item's new bid strategy print(f'Line Item {response["name"]} is now using the following bid' f' strategy: {response["bidStrategy"]}.')