برخلاف سایر داراییها، پس از ایجاد مجموعه دارایی، داراییهای مکان بهطور خودکار توسط Google Ads API ایجاد میشوند. ابتدا یک مجموعه دارایی همگامسازی مکان ایجاد کنید و آن را به مشتری متصل کنید. سپس، اگر میخواهید زیرمجموعهای از داراییهای مکان در مجموعه دارایی را برای یک کمپین یا گروه تبلیغاتی انتخاب کنید، یک مجموعه دارایی گروه مکان ایجاد کنید و آن را به کمپین یا گروه تبلیغات پیوست کنید.
یک مجموعه دارایی همگامسازی مکان ایجاد کنید و آن را به مشتری پیوست کنید
- یک مجموعه دارایی همگامسازی مکان ایجاد کنید .
- آن را با استفاده از
CustomerAssetSetService
به مشتری وصل کنید .
یک مجموعه دارایی همگامسازی مکان ایجاد کنید
- یک
AssetSet
جدید ایجاد کنید.-
type
رویLOCATION_SYNC
تنظیم کنید. -
location_set
را رویLocationSet
جدید تنظیم کنید.
-
- در
LocationSet
جدید،-
location_ownership_type
را بر اساس مورد استفاده خود تنظیم کنید:- اگر صاحب مکان کسب و کار هستید، آن را روی
BUSINESS_OWNER
تنظیم کنید. - اگر مالک محل کسب و کار نیستید، اما محصولات خود را در آنجا بفروشید، آن را روی
AFFILIATE
تنظیم کنید.
- اگر صاحب مکان کسب و کار هستید، آن را روی
-
source
یک فیلد را بر اساس مورد استفاده خود تنظیم کنید:- اگر میخواهید با مکانهایتان در حساب Google Business Profile همگامسازی شود،
business_profile_location_set
تنظیم کنید. - اگر میخواهید با مکانهای موجود در شناسههای زنجیره مشخص شده همگامسازی کنید
chain_location_set
تنظیم کنید. - اگر میخواهید به صورت دستی مکانها را با استفاده از شناسههای مکان اضافه کنید،
maps_location_set
تنظیم کنید.
- اگر میخواهید با مکانهایتان در حساب Google Business Profile همگامسازی شود،
-
پس از تکمیل این مراحل، Google Ads API داراییهای موقعیت مکانی را ایجاد میکند و آنها را به مجموعه دارایی همگامسازی مکان ایجاد شده برای شما اضافه میکند، مشابه زمانی که به صورت دستی این کار را با استفاده از AssetSetAssetService
انجام میدهید. نیازی نیست آنها را دستکاری کنید مگر اینکه بخواهید به صورت دستی آنها را به مجموعه دارایی های گروه مکان ثابت اضافه کنید .
فقط یک مجموعه دارایی همگامسازی مکان فعال با ( status
ENABLED
) میتواند برای یک مشتری وجود داشته باشد. اگر میخواهید نوع دیگری از مجموعه دارایی همگامسازی مکان ایجاد کنید، ابتدا مجموعه موجود را حذف کنید.
مجموعه دارایی همگامسازی مکان را به مشتری پیوست کنید
از CustomerAssetSetService.MutateCustomerAssetSets
برای پیوست کردن مجموعه دارایی همگام سازی مکان در بخش قبلی به مشتری خود استفاده کنید.
(اختیاری) یک مجموعه دارایی گروه مکان ایجاد کنید و آن را به یک کمپین یا یک گروه تبلیغاتی پیوست کنید
مجموعه دارایی گروه مکان فقط در صورتی ضروری است که نیاز به انتخاب زیرمجموعه ای از دارایی های مکان داشته باشید. این به خاطر کمپین ها و گروه های تبلیغاتی است که دارایی های مکان را از سطح مشتری به ارث می برند.
مجموعههای دارایی گروه مکان شامل زیرمجموعهای از داراییهای مکان مجموعه دارایی همگامسازی مکان هستند. میتوانید با استفاده از برخی ویژگیهای نمایه کسبوکار Google (مانند فیلتر کردن بر اساس برچسبها) یا شناسههای زنجیره و مکانهای زنجیره بهصورت پویا یک مجموعه دارایی گروه مکان ایجاد کنید. از طرف دیگر، می توانید به صورت ایستا یک مجموعه دارایی گروه مکان ایجاد کنید.
- مجموعه دارایی گروه مکان ایجاد کنید . مجموعه دارایی گروه مکان می تواند پویا یا ایستا باشد.
- بسته به نیازتان، مجموعه دارایی را با استفاده از یا به یک گروه تبلیغاتی به یک کمپین ضمیمه کنید .
- (اختیاری) دارایی های ایجاد شده قبلی را به مجموعه دارایی گروه مکان ایستا ایجاد شده جدید اضافه کنید .
برای یک مشتری معین، می توانید چندین مجموعه دارایی گروه مکان پویا یا ثابت ایجاد کنید.
مجموعه دارایی گروه مکان ایجاد کنید
یک AssetSet
جدید ایجاد کنید و location_group_parent_asset_set_id
را روی شناسه مجموعه دارایی همگامسازی موقعیت مکانی ایجاد شده قبلی تنظیم کنید.
سپس، برخی فیلدها را بر اساس اینکه آیا میخواهید یک مجموعه دارایی گروه مکان پویا یا ایستا ایجاد کنید، تنظیم کنید.
مجموعه دارایی های پویا
بسته به فیلدی که در LocationSet
تنظیم کرده اید، فیلدها را بر اساس قانون زیر تنظیم کنید:
اگر فیلد زیر را تنظیم کنید | سپس نوع را بر روی تنظیم کنید | و این فیلد را به عنوان فیلد asset_set_source oneof تنظیم کنید |
---|---|---|
business_profile_location_set | BUSINESS_PROFILE_DYNAMIC_LOCATION_GROUP | business_profile_location_group |
chain_location_set | CHAIN_DYNAMIC_LOCATION_GROUP | chain_location_group |
اگر هنگام ایجاد مجموعه دارایی همگامسازی مکان ، maps_location_set
را تنظیم کنید، نمیتوانید مجموعه دارایی گروه مکان پویا ایجاد کنید. این به این دلیل است که شما به صورت دستی مکانها را بر اساس شناسه مکان اضافه کردهاید و هیچ ویژگی فیلتری وجود ندارد که بتوانید برای این نوع مکانها استفاده کنید.
مجموعه دارایی های ایستا
type
روی STATIC_LOCATION_GROUP
تنظیم کنید. میتوانید مجموعههای دارایی گروه مکان ایستا را برای هر نوع مجموعه دارایی همگامسازی موقعیت مکانی ایجاد کنید، بدون توجه به اینکه چه فیلدی را در LocationSet
تنظیم میکنید ( business_profile_location_set
، chain_location_set
، یا maps_location_set
).
برای مجموعه دارایی های گروه مکان ایستا ، باید دارایی های مکان ایجاد شده را به صورت دستی به مجموعه دارایی های گروه مکان اضافه کنید .
مجموعه دارایی را به یک کمپین یا یک گروه تبلیغاتی وصل کنید
از CampaignAssetSetService.MutateCampaignAssetSets
برای پیوست کردن مجموعه دارایی گروه مکان به کمپین خود استفاده کنید.
از طرف دیگر، اگر میخواهید مجموعه دارایی گروه مکان را به یک گروه تبلیغاتی وصل کنید، از AdGroupAssetSetService.MutateAdGroupAssetSets
استفاده کنید.
(اختیاری) دارایی های مکان را به مجموعه دارایی گروه مکان ایستا اضافه کنید
این مرحله فقط در صورتی لازم است که قبلاً یک مجموعه دارایی گروه مکان ثابت ایجاد کرده باشید.
- از گزارش
asset_set_asset
برای واکشی نام منابع داراییهایی که به طور خودکار برای مجموعه دارایی همگامسازی مکان ایجاد شده قبلی ایجاد شدهاند، استفاده کنید. از فیلتر کردن فقط برای بازیابی دارایی های مورد نظر خود استفاده کنید. - آنها را با استفاده از
AssetSetAssetService.MutateAssetSetAssets
به مجموعه دارایی گروه مکان ثابت اضافه کنید.
شناسههای مکان نمایه کسبوکار را مدیریت کنید
وقتی از یک business_profile_location_set
استفاده میکنید و روی listing_id_filters
که از وبسایت Business Profile یا API بازیابی میشوند، فیلتر میکنید، ممکن است لازم باشد این مقادیر عددی را از نوع uint64
به int64
تبدیل کنید. اگر کد شما هنگام اضافه کردن آن به قسمت تکراری listing_id_filters[] خطای زمان اجرا ایجاد میکند که شناسه مکان نمایه کسبوکار شما خارج از محدوده است، احتمالاً باید آن را با استفاده از یکی از مثالهای زیر تبدیل کنید:
جاوا
/**
* 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);
}
سی شارپ
/// <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;
}
پایتون
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
روبی
# 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
پرل
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;
}
}