Im Gegensatz zu anderen Assets werden Standort-Assets automatisch von der Google Ads API erstellt, nachdem Sie eine Asset-Gruppe erstellt haben. Erstellen Sie zuerst eine Asset-Gruppe für die Standortsynchronisierung und hängen Sie sie an den Kunden an. Wenn Sie dann eine Teilmenge der Standort-Assets im Asset-Set für eine Kampagne oder Anzeigengruppe auswählen müssen, erstellen Sie ein Standortgruppen-Asset-Set und hängen Sie es an die Kampagne oder Anzeigengruppe an.
Standortsynchronisations-Asset-Set erstellen und dem Kunden zuweisen
- Erstellen Sie eine Standortsynchronisierung-Asset-Gruppe.
- Mit
CustomerAssetSetService
einem Kunden zuweisen.
Asset-Set für die Standortsynchronisierung erstellen
- Erstellen Sie einen neuen
AssetSet
.- Setzen Sie
type
aufLOCATION_SYNC
. - Legen Sie
location_set
auf eine neueLocationSet
fest.
- Setzen Sie
- In der neuen
LocationSet
:- Legen Sie
location_ownership_type
entsprechend Ihrem Anwendungsfall fest:- Legen Sie den Wert auf
BUSINESS_OWNER
fest, wenn Sie der Inhaber des Unternehmensstandorts sind. - Legen Sie den Wert auf
AFFILIATE
fest, wenn Sie nicht Inhaber des Geschäftsstandorts sind, dort aber Ihre Produkte verkaufen.
- Legen Sie den Wert auf
- Legen Sie das „oneof“-Feld
source
entsprechend Ihrem Anwendungsfall fest:- Legen Sie
business_profile_location_set
fest, wenn Sie die Standorte in Ihrem Google Unternehmensprofil-Konto synchronisieren möchten. - Legen Sie
chain_location_set
fest, wenn Sie Standorte mit bestimmten Ketten-IDs synchronisieren möchten. - Legen Sie
maps_location_set
fest, wenn Sie Standorte manuell mit Orts-IDs hinzufügen möchten.
- Legen Sie
- Legen Sie
Nachdem Sie diese Schritte ausgeführt haben, werden mit der Google Ads API Standort-Assets generiert und dem erstellten Asset-Set für die Standortsynchronisierung hinzugefügt. Das ist vergleichbar mit dem manuellen Vorgehen über AssetSetAssetService
. Sie müssen sie nicht bearbeiten, es sei denn, Sie möchten sie manuell Asset-Sets für statische Standortgruppen hinzufügen.
Für einen Kunden kann nur ein aktiver Asset-Satz für die Standortsynchronisierung mit (status
von ENABLED
) vorhanden sein. Wenn Sie ein anderes Asset-Set für die Standortsynchronisierung erstellen möchten, müssen Sie das vorhandene zuerst entfernen.
Asset-Gruppe für die Standortsynchronisierung einem Kunden zuweisen
Verwenden Sie CustomerAssetSetService.MutateCustomerAssetSets
, um den im vorherigen Abschnitt festgelegten Asset-Satz für die Standortsynchronisierung an Ihren Kunden anzuhängen.
Optional: Asset-Gruppe für Standortgruppen erstellen und einer Kampagne oder Anzeigengruppe zuweisen
Ein Asset-Set vom Typ Standortgruppe ist nur erforderlich, wenn Sie eine Teilmenge von Standort-Assets auswählen müssen. Das liegt daran, dass Kampagnen und Anzeigengruppen Standort-Assets von der Kundenebene übernehmen.
Asset-Gruppen-Asset-Sets enthalten eine Teilmenge der Standort-Assets des Asset-Sets Standortsynchronisierung. Sie können dynamisch ein Asset-Set für Standortgruppen erstellen, indem Sie einige Funktionen von Google Unternehmensprofil nutzen, z. B. das Filtern nach Labels, oder Ketten-IDs und Kettenstandorte. Alternativ können Sie statisch einen Asset-Satz für Standortgruppen erstellen.
- Asset-Gruppe für Standortgruppe erstellen Die Asset-Gruppe für Standortgruppen kann dynamisch oder statisch sein.
- Asset-Gruppe an eine Kampagne oder Anzeigengruppe anhängen
- Optional: Fügen Sie die zuvor generierten Assets dem neu erstellten Asset-Set für statische Standorte hinzu.
Sie können für einen bestimmten Kunden mehrere dynamische oder statische Asset-Sets für Standortgruppen erstellen.
Asset-Set für Standortgruppen erstellen
Erstellen Sie ein neues AssetSet
und legen Sie location_group_parent_asset_set_id
auf die ID des zuvor erstellten Asset-Sets für die Standortsynchronisierung fest.
Legen Sie dann einige Felder fest, je nachdem, ob Sie ein dynamisches oder statisches Asset-Set für Standortgruppen erstellen möchten.
Dynamische Asset-Gruppen
Legen Sie die Felder basierend auf der folgenden Regel fest, je nachdem, welches Feld Sie in LocationSet
festgelegt haben:
Wenn Sie das folgende Feld festlegen | Legen Sie dann type auf | Legen Sie dieses Feld als asset_set_source-Oneof-Feld fest. |
---|---|---|
business_profile_location_set |
BUSINESS_PROFILE_DYNAMIC_LOCATION_GROUP |
business_profile_location_group |
chain_location_set |
CHAIN_DYNAMIC_LOCATION_GROUP |
chain_location_group |
Wenn Sie maps_location_set
beim Erstellen der Asset-Gruppe für die Standortsynchronisierung festlegen, können Sie keine dynamische Asset-Gruppe für Standortgruppen erstellen. Das liegt daran, dass Sie Standorte manuell über Orts-IDs hinzugefügt haben und für diese Art von Standorten keine Filterfunktionen verfügbar sind.
Statische Asset-Gruppen
Setzen Sie type
auf
STATIC_LOCATION_GROUP
.
Sie können statische Asset-Sets für Standortgruppen für alle Arten von Asset-Sets für die Standortsynchronisierung erstellen, unabhängig davon, welche Felder (business_profile_location_set
, chain_location_set
oder maps_location_set
) Sie in LocationSet
festlegen.
Bei statischen Asset-Sets für Standortgruppen müssen Sie die generierten Standort-Assets manuell den Asset-Sets für Standortgruppen hinzufügen.
Asset-Gruppe einer Kampagne oder Anzeigengruppe zuordnen
Verwenden Sie CampaignAssetSetService.MutateCampaignAssetSets
, um die Asset-Gruppe für Standortgruppen an Ihre Kampagne anzuhängen.
Alternativ können Sie AdGroupAssetSetService.MutateAdGroupAssetSets
verwenden, wenn Sie den Asset-Satz für Standortgruppen stattdessen einer Anzeigengruppe zuordnen möchten.
Optional: Standort-Assets dem Asset-Set der Standortgruppe static hinzufügen
Dieser Schritt ist nur erforderlich, wenn Sie zuvor einen Asset-Satz für statische Standortgruppen erstellt haben.
- Verwenden Sie den Bericht
asset_set_asset
, um die Ressourcennamen von Assets abzurufen, die automatisch für die zuvor erstellte Asset-Gruppe für die Standortsynchronisierung generiert wurden. Verwenden Sie Filter, um nur die gewünschten Assets abzurufen. - Fügen Sie sie dem Asset-Set für statische Standortgruppen mit
AssetSetAssetService.MutateAssetSetAssets
hinzu.
Standort-IDs von Unternehmensprofilen verwalten
Wenn Sie ein business_profile_location_set
verwenden und nach listing_id_filters
filtern, die von der Business Profile-Website oder ‑API abgerufen werden, müssen Sie diese numerischen Werte möglicherweise vom Typ uint64
in int64
konvertieren. Wenn Ihr Code einen Laufzeitfehler generiert, der besagt, dass Ihre Unternehmensprofil-Standort-ID außerhalb des gültigen Bereichs liegt, wenn Sie sie dem wiederholten Feld „listing_id_filters[]“ hinzufügen, müssen Sie sie wahrscheinlich mit einem der folgenden Beispiele konvertieren:
Java
/**
* Converts the business profile location ID to the format expected by the
* DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
* The business profile location ID is an unsigned 64-bit integer, while the
* listing_id_filters[] field expects signed 64-bit integers. This means that
* for business profile location IDs that are out of range, we must perform the
* two's complement to convert it into a signed int.
*
* @param businessProfileLocationId The ID of a Business Profile location ID.
* @return a Business Profile location ID as a signed 64-bit integer (long).
*/
public static long convertBusinessProfileLocationId(String businessProfileLocationId) {
return Long.parseUnsignedLong(businessProfileLocationId);
}
C#
/// <summary>
/// Converts the business profile location ID to the format expected by the
/// DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
/// The business profile location ID is an unsigned 64-bit integer, while the
/// listing_id_filters[] field expects signed 64-bit integers. This means that
/// for business profile location IDs that are out of range, we must perform the
/// two's complement to convert it into a signed int.
/// </summary>
/// <param name="businessProfileLocationId">The ID of a Business Profile location.</param>
/// <returns>The converted business location ID in signed 64 bit.</returns>
public long ConvertBusinessProfileLocationId(ulong businessProfileLocationId)
{
return unchecked((long)businessProfileLocationId);
}
PHP
/**
* Converts a business profile location ID to a signed 64 bit integer.
*
* Converts the business profile location ID to the format expected by the
* DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
* The business profile location ID is an unsigned 64-bit integer, while the
* listing_id_filters[] field expects signed 64-bit integers. This means that
* for business profile location IDs that are out of range, we must perform the
* two's complement to convert it into a signed int.
*
* @param string $businessProfileLocationId the ID of a Business Profile location
* @return int the converted business location ID in signed 64 bit
*/
public static function convertBusinessProfileLocationId(string $businessProfileLocationId): int
{
$unsignedMax = '18446744073709551615'; // 2^64 - 1
$signedMax = '9223372036854775807'; // 2^63 - 1
// Check if the business profile location ID is within 64 bit range.
// If not, throw an error.
if (bccomp($businessProfileLocationId, '0') < 0 || bccomp($businessProfileLocationId, $unsignedMax) > 0) {
throw new InvalidArgumentException(
'The given business profile location id is outside of the range for a 64 bit integer.'
);
}
// Check if the business profile location ID is in signed 64 bit range.
// If it's not, convert it to its two's complement.
if (bccomp($businessProfileLocationId, $signedMax) > 0) {
// Two's complement: ID - 2^64
return (int) bcsub($businessProfileLocationId, '18446744073709551616');
}
return (int) $businessProfileLocationId;
}
Python
import ctypes
def convert_business_profile_location_id(business_profile_location_id):
"""Converts a business profile location ID to a signed 64 bit integer.
Converts the business profile location ID to the format expected by the
DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
The business profile location ID is an unsigned 64-bit integer, while the
listing_id_filters[] field expects signed 64-bit integers. This means that
for business profile location IDs that are out of range, we must perform the
two's complement to convert it into a signed int.
Args:
business_profile_location_id: the ID of a Business Profile location ID.
Returns:
a Business Profile location ID as a signed 64 bit integer.
"""
# Check if the business profile location ID is within 64 bit range.
# If not, throw an error.
if business_profile_location_id >= 2 ** 64:
raise ValueError(
"The given business profile location id is outside of the range for a 64 bit integer."
)
# Check if the business profile location ID is in signed 64 bit range.
# If it's not, convert it to its two's complement.
elif business_profile_location_id >= 2 ** 63:
return ctypes.c_int64(business_profile_location_id).value
else:
return business_profile_location_id
Ruby
# Converts the business profile location ID to the format expected by the
# DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
# The business profile location ID is an unsigned 64-bit integer, while the
# listing_id_filters[] field expects signed 64-bit integers. This means that
# for business profile location IDs that are out of range, we must perform the
# two's complement to convert it into a signed int.
# Since Ruby supports arbitrary precision numbers, we have to calculate it
# manually.
LONG_MAX = 2 ** 63
ULONG_MAX = LONG_MAX * 2
def convert_business_profile_location_id(business_profile_location_id)
# Check if the business profile location ID is within 64 bit range.
# If not, throw an error.
if business_profile_location_id >= 2 ** 64
raise "The given business profile location id is outside of the range for a 64 bit integer."
# Check if the business profile location ID is in signed 64 bit range.
# If it's not, convert it to its two's complement.
elseif business_profile_location_id >= 2**63
-1 * (ULONG_MAX - business_profile_location_id)
else
business_profile_location_id
end
end
Perl
use bigint;
# Converts the business profile location ID to the format expected by the
# DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
# The business profile location ID is an unsigned 64-bit integer, while the
# listing_id_filters[] field expects signed 64-bit integers. This means that
# for business profile location IDs that are out of range, we must perform the
# two's complement to convert it into a signed int.
sub convert_business_profile_location_id {
my ($business_profile_location_id) = @_;
# Check if the business profile location ID is within 64 bit range.
# If not, throw an error.
if ($business_profile_location_id >= 2**64) {
die "The given business profile location id is outside of the range for a 64 bit integer";
# Check if the business profile location ID is in signed 64 bit range.
# If it's not, convert it to its two's complement.
} elseif ($business_profile_location_id >= 2**63) {
return -1 * (2**64 - $business_profile_location_id);
} else {
return $business_profile_location_id;
}
}