Ressourcen aktivieren

Nachdem Sie Ihre Demand Gen-Ressourcen erstellt und konfiguriert haben, können Sie ihre entityStatus-Felder auf ENTITY_STATUS_ACTIVE aktualisieren, damit Anzeigen ausgeliefert werden. Alle drei Ressourcen müssen aktiv sein, damit Anzeigen ausgeliefert werden können.

LineItem-Ressourcen müssen mit dem EntityStatus „draft“ erstellt und in einer nachfolgenden Anfrage aktiviert werden. AdGroup- und AdGroupAd-Ressourcen können mit dem EntityStatus-Status „Aktiv“ erstellt werden. Es wird jedoch empfohlen, diese Ressourcen mit dem Status „Pausiert“ zu erstellen. So können Sie das Targeting zuweisen und die korrekte Konfiguration überprüfen, bevor Sie die Ressourcen in nachfolgenden Anfragen aktivieren.

Werbebuchung aktivieren

So aktivieren Sie eine Werbebuchung:

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']}."
)

Anzeigengruppe aktivieren

So aktivieren Sie eine Anzeigengruppe:

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']}."
)

Anzeige aktivieren

So aktivieren Sie eine Anzeige:

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']}."
)