리소스 활성화

수요 생성 리소스를 만들고 구성한 후 entityStatus 필드를 ENTITY_STATUS_ACTIVE로 업데이트하여 광고 게재를 시작할 수 있습니다. 광고 게재를 시작하려면 세 가지 리소스가 모두 활성 상태여야 합니다.

LineItem 리소스는 "초안" EntityStatus로 만들어야 하며 후속 요청에서 활성화해야 합니다. AdGroupAdGroupAd 리소스는 '활성' EntityStatus로 만들 수 있지만 '일시중지됨' 상태로 이러한 리소스를 만드는 것이 좋습니다. 이렇게 하면 후속 요청에서 리소스를 활성화하기 전에 타겟팅을 할당하고 올바른 구성을 확인할 수 있습니다.

광고 항목 활성화

광고 항목을 활성화하는 방법은 다음과 같습니다.

Python

# The ID of the line item's parent advertiser.
advertiser_id = advertiser-id

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

line_item_obj = {
    "entityStatus": "ENTITY_STATUS_ACTIVE",
}

# Build and execute request.
response = (
    service.advertisers()
    .lineItems()
    .patch(
        advertiserId=advertiser_id,
        lineItemId=line_item_id,
        updateMask="entityStatus",
        body=line_item_obj,
    )
    .execute()
)

# Display the line item's new entity status
print(
    f"Line item {response['name']} now has entity status "
    f"{response['entityStatus']}."
)

광고그룹 활성화

광고그룹을 활성화하는 방법은 다음과 같습니다.

Python

# The ID of the ad group's parent advertiser.
advertiser_id = advertiser-id

# The ID of the Demand Gen ad group.
ad_group_id = ad-group-id

ad_group_obj = {
    "entityStatus": "ENTITY_STATUS_ACTIVE",
}

# Build and execute request.
response = (
    service.advertisers()
    .adGroups()
    .patch(
        advertiserId=advertiser_id,
        adGroupId=ad_group_id,
        updateMask="entityStatus",
        body=ad_group_obj,
    )
    .execute()
)

# Display the ad group's new entity status
print(
    f"Ad group {response['name']} now has entity status "
    f"{response['entityStatus']}."
)

광고 활성화

광고를 활성화하는 방법은 다음과 같습니다.

Python

# The ID of the ad's parent advertiser.
advertiser_id = advertiser-id

# The ID of the Demand Gen ad.
ad_id = ad-group-ad-id

ad_obj = {
    "entityStatus": "ENTITY_STATUS_ACTIVE",
}

# Build and execute request.
response = (
    service.advertisers()
    .adGroupAds()
    .patch(
        advertiserId=advertiser_id,
        adGroupAdId=ad_id,
        updateMask="entityStatus",
        body=ad_obj,
    )
    .execute()
)

# Display the ad's new entity status
print(
    f"Ad {response['name']} now has entity status "
    f"{response['entityStatus']}."
)