타겟팅 할당

디맨드젠 캠페인 광고 게재는 상위 파트너, 광고주, 광고 항목, 광고 그룹에 할당된 타겟팅을 사용하여 제어됩니다.

디맨드젠 캠페인 광고 항목 및 광고 그룹에 할당된 타겟팅을 사용하여 이상적인 고객에게 도달하고 캠페인 실적을 개선하세요.

타겟팅을 할당할 위치 결정

타겟팅은 디맨드젠 캠페인 광고 항목과 광고 그룹 모두에 할당할 수 있습니다.

타겟팅이 해당 광고 항목에 게재되는 모든 광고에 적용되도록 하려면 디맨드젠 캠페인 광고 항목에 타겟팅을 할당합니다. 그렇지 않으면 개별 광고 그룹에 타겟팅을 할당합니다.

디맨드젠 캠페인 리소스 유형별 타겟팅 지원

각 리소스 유형은 특정 유형의 타겟팅을 지원합니다.

다음은 디맨드젠 캠페인 광고 항목에서 지원하는 타겟팅 유형의 목록입니다.

  • TARGETING_TYPE_CARRIER_AND_ISP
  • TARGETING_TYPE_DAY_AND_TIME
  • TARGETING_TYPE_DEVICE_MAKE_MODEL
  • TARGETING_TYPE_DEVICE_TYPE
  • TARGETING_TYPE_GEO_REGION
  • TARGETING_TYPE_KEYWORD
  • TARGETING_TYPE_LANGUAGE
  • TARGETING_TYPE_NEGATIVE_KEYWORD_LIST
  • TARGETING_TYPE_OPERATING_SYSTEM
  • TARGETING_TYPE_POI

다음은 디맨드젠 캠페인 광고 그룹에서 지원하는 타겟팅 유형의 목록입니다.

  • TARGETING_TYPE_AGE_RANGE
  • TARGETING_TYPE_APP
  • TARGETING_TYPE_APP_CATEGORY
  • TARGETING_TYPE_AUDIENCE_GROUP
  • TARGETING_TYPE_CATEGORY
  • TARGETING_TYPE_GENDER
  • TARGETING_TYPE_GEO_REGION
  • TARGETING_TYPE_HOUSEHOLD_INCOME
  • TARGETING_TYPE_KEYWORD
  • TARGETING_TYPE_LANGUAGE
  • TARGETING_TYPE_PARENTAL_STATUS
  • TARGETING_TYPE_URL
  • TARGETING_TYPE_YOUTUBE_CHANNEL
  • TARGETING_TYPE_YOUTUBE_VIDEO

TARGETING_TYPE_GEO_REGION, TARGETING_TYPE_POI, TARGETING_TYPE_LANGUAGE 지원은 상위 LineItem 리소스의 demandGenSettings.geoLanguageTargetingEnabled 필드 설정에 따라 다릅니다. 필드가 true이면 위치 및 언어 타겟팅을 상위 광고 항목에만 할당할 수 있습니다. 필드가 false이면 이 타겟팅을 개별 광고 그룹에만 할당할 수 있습니다.

사용 가능한 타겟팅 옵션 찾기

타겟팅은 유형에 따라 식별됩니다. 다음 방법 중 하나를 사용하여 타겟팅 옵션을 식별합니다.

  • 관련 enum 값을 사용합니다. 예를 들어 enum 유형 AgeRange 또는 Exchange와 함께 사용합니다.
  • 관련 서비스를 사용하여 채널 또는 위치 목록과 같은 타겟팅 가능한 항목을 검색합니다.
  • 타겟팅 유형의 타겟팅 옵션 IDlistsearch 메서드를 사용하여 검색합니다.

기존 타겟팅 검색

기존 타겟팅은 광고 항목 또는 광고 그룹에 추가할 수 있는 타겟팅을 제한합니다.

디맨드젠 캠페인 광고 항목 및 광고 그룹에는 상속된 TARGETING_TYPE_KEYWORD 타겟팅만 표시됩니다. 즉, 광고 게재에 영향을 미치는 모든 타겟팅을 완전히 파악하려면 광고주, 광고 항목, 광고 그룹의 타겟팅을 검색해야 합니다.

일괄 목록 요청을 사용하여 타겟팅 유형 전반에서 기존 타겟팅을 검색합니다.

기존 파트너 및 광고주 타겟팅 검색

상속된 파트너 타겟팅을 포함하여 광고주의 기존 타겟팅을 가져오는 방법은 다음과 같습니다.

Python

# Provide the ID of the advertiser.
advertiser_id = advertiser-id

# Create the page token variable.
next_page_token = ""

while True:
  # Execute the list request.
  response = (
      service.advertisers()
      .listAssignedTargetingOptions(
          advertiserId=advertiser_id,
          pageToken=next_page_token,
      )
      .execute()
  )

  # If response is not empty, display the retrieved assigned targeting
  # options.
  if response:
    for assigned_targeting_option in response.get(
        "assignedTargetingOptions", []
    ):
      ato_name = assigned_targeting_option.get(
          "name", None
      )
      if ato_name:
        print(f"Assigned Targeting Option {ato_name}.")
  else:
    print(f"No targeting is currently assigned to {advertiser_id}.")
    sys.exit(1)
  # Update the next page token.
  # Break out of loop if there is no next page.
  if "nextPageToken" in response:
    next_page_token = response["nextPageToken"]
  else:
    break

기존 광고 항목 타겟팅 검색

광고 항목에 직접 할당된 기존 타겟팅을 가져오는 방법은 다음과 같습니다.

Python

# Provide the ID of the parent advertiser.
advertiser_id = advertiser-id

# Provide the ID of the Demand Gen line item.
line_item_id = line-item-id

# Create the page token variable.
next_page_token = ""

while True:
  # Execute the list request.
  response = (
      service.advertisers()
      .lineItems()
      .bulkListAssignedTargetingOptions(
          advertiserId=advertiser_id,
          lineItemIds=[line_item_id],
          pageToken=next_page_token,
      )
      .execute()
  )

  # If response is not empty, display the retrieved assigned targeting
  # options line items.
  if response:
    for assigned_option in response.get(
        "lineItemAssignedTargetingOptions", []
    ):
      ato_name = assigned_option.get("assignedTargetingOption", {}).get(
          "name", None
      )
      if ato_name:
        print(f"Assigned Targeting Option {ato_name} found.")
  else:
    print(f"No targeting is currently assigned to {line_item_id}.")
    sys.exit(1)
  # Update the next page token.
  # Break out of loop if there is no next page.
  if "nextPageToken" in response:
    next_page_token = response["nextPageToken"]
  else:
    break

기존 광고 그룹 타겟팅 검색

광고 그룹에 직접 할당된 기존 타겟팅을 가져오는 방법은 다음과 같습니다.

Python

# Provide the ID of the parent advertiser.
advertiser_id = advertiser-id

# Provide the ID of the ad group.
ad_group_id = ad-group-id

# Create the page token variable.
next_page_token = ""

while True:
  # Execute the list request.
  response = (
      service.advertisers()
      .adGroups()
      .bulkListAssignedTargetingOptions(
          advertiserId=advertiser_id,
          adGroupIds=[ad_group_id],
          pageToken=next_page_token,
      )
      .execute()
  )

  # If response is not empty, display the retrieved assigned targeting
  # options line items.
  if response:
    for assigned_option in response.get(
        "adGroupAssignedTargetingOptions", []
    ):
      ato_name = assigned_option.get("assignedTargetingOption", {}).get(
          "name", None
      )
      if ato_name:
        print(f"Assigned Targeting Option {ato_name} found.")
  else:
    print(f"No targeting is currently assigned to {ad_group_id}.")
    sys.exit(1)
  # Update the next page token.
  # Break out of loop if there is no next page.
  if "nextPageToken" in response:
    next_page_token = response["nextPageToken"]
  else:
    break

리소스에 타겟팅 할당

광고 항목 및 광고 그룹 타겟팅을 업데이트하려면 별도의 요청을 해야 합니다.

광고 항목 타겟팅 할당

광고 항목에 다음 타겟팅 로직을 추가하는 방법은 다음과 같습니다.

  • 컴퓨터에만 광고를 게재합니다.
  • '아이스크림' 키워드와 일치하는 콘텐츠와 함께 게재되는 인벤토리에 입찰하지 않습니다.

Python

# Provide the ID of the parent advertiser.
advertiser_id = advertiser-id

# Provide the ID of the line item.
line_item_id = line-item-id

# Build the "ice cream" negative keyword assigned targeting option.
keyword_assigned_targeting_option = {
    "keywordDetails": {"keyword": "ice cream", "negative": True}
}

# Build the delete request for device type targeting to remove all device
# types to only target computers.
device_type_delete_request = {
    "targetingType": "TARGETING_TYPE_DEVICE_TYPE",
    "assignedTargetingOptionIds": [
        "DEVICE_TYPE_SMART_PHONE",
        "DEVICE_TYPE_CONNECTED_TV",
        "DEVICE_TYPE_TABLET"
    ],
}

# Create a bulk edit request.
bulk_edit_targeting_request = {
    "lineItemIds": [line_item_id],
    "createRequests": [
        {
            "targetingType": "TARGETING_TYPE_KEYWORD",
            "assignedTargetingOptions": [
                keyword_assigned_targeting_option
            ],
        }
    ],
    "deleteRequests": [
        device_type_delete_request
    ]
}

# Build and execute request.
response = (
    service.advertisers()
    .lineItems()
    .bulkEditAssignedTargetingOptions(
        advertiserId=advertiser_id, body=bulk_edit_targeting_request
    )
    .execute()
)

# Print the request results.
if (
    "updatedLineItemIds" in response
    and len(response["updatedLineItemIds"]) != 0
):
  print(
      f'Targeting configurations for {response["updatedLineItemIds"][0]} '
      "were successfully updated."
  )
elif (
    "failedLineItemIds" in response
    and len(response["failedLineItemIds"]) != 0
):
  print(
      f'Targeting configurations for {response["failedLineItemIds"][0]} '
      "failed to update."
  )
  if "errors" in response and len(response["errors"]) != 0:
    print("The failed updates were caused by the following errors:")
    for error in response["errors"]:
      print(f'Code {error["code"]}: {error["message"]}')
else:
  print("No successful or failed updates were reported.")

광고 그룹 타겟팅 할당

광고 그룹에 다음 타겟팅 로직을 추가하는 방법은 다음과 같습니다.

  • 부모에게만 게재합니다.
  • 제공된 YouTube 채널에 대해 게재하지 않습니다.

Python

# Provide the ID of the parent advertiser.
advertiser_id = advertiser-id

# Provide the ID of the ad group.
ad_group_id = ad-group-id

# Provide the YouTube channel ID to negatively target.
yt_channel_id = youtube-channel-id

# Build the assigned targeting option to negatively target the given YouTube
# channel.
youtube_channel_assigned_targeting_options = [
    {
        "youtubeChannelDetails": {
            "channelId": yt_channel_id,
            "negative": True
        }
    },
]

# Build the assigned targeting options to target only parents.
parental_status_assigned_targeting_options = [
    {
        "parentalStatusDetails": {
            "parentalStatus": "PARENTAL_STATUS_PARENT"
        }
    },
]

# Create a bulk edit request.
bulk_edit_targeting_request = {
    "adGroupIds": [ad_group_id],
    "createRequests": [
        {
            "targetingType": "TARGETING_TYPE_YOUTUBE_CHANNEL",
            "assignedTargetingOptions": (
                youtube_channel_assigned_targeting_options
            )
        },
        {
            "targetingType": "TARGETING_TYPE_PARENTAL_STATUS",
            "assignedTargetingOptions": (
                parental_status_assigned_targeting_options
            ),
        }
    ]
}

# Build and execute request.
response = (
    service.advertisers()
    .adGroups()
    .bulkEditAssignedTargetingOptions(
        advertiserId=advertiser_id, body=bulk_edit_targeting_request
    )
    .execute()
)

# Print the request results.
if (
    "updatedAdGroupIds" in response
    and len(response["updatedAdGroupIds"]) != 0
):
  print(
      f'Targeting configurations for {response["updatedAdGroupIds"][0]} '
      "were successfully updated."
  )
elif (
    "failedAdGroupIds" in response
    and len(response["failedAdGroupIds"]) != 0
):
  print(
      f'Targeting configurations for {response["failedAdGroupIds"][0]} '
      "failed to update."
  )
  if "errors" in response and len(response["errors"]) != 0:
    print("The failed updates were caused by the following errors:")
    for error in response["errors"]:
      print(f'Code {error["code"]}: {error["message"]}')
else:
  print("No successful or failed updates were reported.")