برخلاف سایر داراییها، داراییهای مکان پس از ایجاد یک مجموعه دارایی، بهطور خودکار توسط API گوگل ادز ایجاد میشوند. ابتدا، یک مجموعه دارایی همگامسازی مکان ایجاد کنید و آن را به مشتری پیوست کنید. سپس، اگر نیاز به انتخاب زیرمجموعهای از داراییهای مکان در مجموعه دارایی برای یک کمپین یا گروه تبلیغاتی دارید، یک مجموعه دارایی گروه مکانی ایجاد کنید و آن را به کمپین یا گروه تبلیغاتی پیوست کنید.
یک مجموعه دارایی همگامسازی موقعیت مکانی ایجاد کنید و آن را به مشتری پیوست کنید
- یک مجموعه داده همگامسازی مکان ایجاد کنید .
- با استفاده از
CustomerAssetSetServiceآن را به یک مشتری متصل کنید .
ایجاد مجموعه دادههای همگامسازی مکان
- یک
AssetSetجدید ایجاد کنید.-
typeرویLOCATION_SYNCتنظیم کنید. -
location_setروی یکLocationSetجدید تنظیم کنید.
-
در
LocationSetجدید،-
location_ownership_typeبر اساس مورد استفاده خود تنظیم کنید:- اگر مالک مکان کسبوکار هستید، آن را روی
BUSINESS_OWNERتنظیم کنید. - اگر مالک محل کسب و کار نیستید، اما محصولات خود را در آنجا میفروشید، آن را روی
AFFILIATEتنظیم کنید.
- اگر مالک مکان کسبوکار هستید، آن را روی
فیلد
sourceoneof را بر اساس مورد استفاده خود تنظیم کنید:اگر میخواهید مکانهای شما در حساب نمایه کسبوکار گوگل (Google Business Profile) همگامسازی شوند،
business_profile_location_setتنظیم کنید.وقتی یک
BusinessProfileLocationSetبرای پیوند دادن گوگل ادز به یک حساب کاربری گوگل بیزینس پروفایل ایجاد میکنید، باید یک توکن دسترسی OAuth 2.0 در فیلدhttp_authorization_tokenارائه دهید. این توکن به عنوان مدرکی عمل میکند که شما به گوگل ادز اجازه میدهید به دادههای مکانی از پروفایل گوگل بیزینس مشخص شده دسترسی داشته باشد.توکن باید این الزامات را برآورده کند:
- این باید برای حساب گوگل (حساب کاربری یا سرویس) که آدرس ایمیل آن در فیلد
email_addressازBusinessProfileLocationSetارائه شده است، ایجاد شود. - این حساب باید مجوزهای کافی برای خواندن مکانهای کسبوکار در نمایه کسبوکار گوگل (Google Business Profile) را داشته باشد.
- توکن OAuth 2.0 باید با دامنه
https://www.googleapis.com/auth/business.manageدریافت شود.
برای دستورالعملهای دقیق در مورد نحوه تولید توکن دسترسی OAuth 2.0، به «استفاده از OAuth 2.0 برای دسترسی به APIهای گوگل» مراجعه کنید.
- این باید برای حساب گوگل (حساب کاربری یا سرویس) که آدرس ایمیل آن در فیلد
اگر میخواهید با مکانهایی که در شناسههای زنجیره مشخصشده قرار دارند همگامسازی انجام شود
chain_location_setتنظیم کنید.اگر میخواهید مکانها را با استفاده از شناسههای مکان به صورت دستی اضافه کنید،
maps_location_setرا تنظیم کنید.
-
پس از تکمیل این مراحل، API گوگل ادز، دادههای مکانی را تولید کرده و آنها را به مجموعه دادههای همگامسازی مکان ایجاد شده برای شما اضافه میکند، مشابه زمانی که این کار را به صورت دستی با استفاده از AssetSetAssetService انجام میدهید. نیازی به دستکاری آنها ندارید، مگر اینکه بخواهید آنها را به صورت دستی به مجموعه دادههای گروه مکانی ایستا اضافه کنید .
فقط یک مجموعه دارایی همگامسازی مکان فعال با ( status ENABLED ) میتواند برای یک مشتری وجود داشته باشد. اگر نیاز به ایجاد نوع متفاوتی از مجموعه دارایی همگامسازی مکان دارید، ابتدا مجموعه موجود را حذف کنید.
مجموعه همگامسازی موقعیت مکانی را به مشتری پیوست کنید
از CustomerAssetSetService.MutateCustomerAssetSets برای ضمیمه کردن مجموعه دادههای همگامسازی موقعیت مکانی در بخش قبلی به مشتری خود استفاده کنید.
(اختیاری) یک مجموعه دارایی گروه مکان ایجاد کنید و آن را به یک کمپین یا یک گروه تبلیغاتی پیوست کنید
مجموعه داراییهای گروه مکان فقط در صورتی ضروری است که نیاز به انتخاب زیرمجموعهای از داراییهای مکان داشته باشید. این به دلیل به ارث بردن داراییهای مکان از سطح مشتری توسط کمپینها و گروههای تبلیغاتی است.
مجموعه داراییهای گروه مکان شامل زیرمجموعهای از داراییهای مکان از مجموعه دارایی همگامسازی مکان است. شما میتوانید با استفاده از برخی ویژگیهای نمایه کسبوکار گوگل (مانند فیلتر کردن بر اساس برچسبها) یا شناسههای زنجیرهای و مکانهای زنجیرهای، یک مجموعه دارایی گروه مکان را به صورت پویا ایجاد کنید. از طرف دیگر، میتوانید یک مجموعه دارایی گروه مکان را به صورت ایستا ایجاد کنید.
- یک مجموعه دارایی گروه مکان ایجاد کنید . مجموعه دارایی گروه مکان میتواند پویا یا ایستا باشد.
- بسته به نیاز خود، مجموعه دارایی را با استفاده از به یک کمپین یا به یک گروه تبلیغاتی متصل کنید .
- (اختیاری) داراییهای تولید شده قبلی را به مجموعه داراییهای گروه مکان ایستا که اخیراً ایجاد شده است، اضافه کنید .
برای یک مشتری مشخص، میتوانید چندین مجموعه دارایی گروه مکانی پویا یا ایستا ایجاد کنید.
ایجاد مجموعه داراییهای گروه مکان
یک 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 تنظیم کنید. میتوانید مجموعههای دارایی گروه موقعیت مکانی استاتیک را برای هر نوع مجموعه دارایی همگامسازی موقعیت مکانی ایجاد کنید، صرف نظر از اینکه چه فیلدهایی ( business_profile_location_set ، chain_location_set یا maps_location_set ) را در LocationSet تنظیم میکنید.
برای مجموعه داراییهای گروه مکان ثابت ، باید داراییهای مکان تولید شده را به صورت دستی به مجموعه داراییهای گروه مکان اضافه کنید .
مجموعه دارایی را به یک کمپین یا یک گروه تبلیغاتی متصل کنید
از CampaignAssetSetService.MutateCampaignAssetSets برای پیوست کردن مجموعه دارایی گروه مکان به کمپین خود استفاده کنید.
روش دیگر این است که اگر میخواهید مجموعه دارایی گروه مکان را به یک گروه تبلیغاتی پیوست کنید، AdGroupAssetSetService.MutateAdGroupAssetSets استفاده کنید.
(اختیاری) داراییهای مکان را به مجموعه داراییهای گروه مکان ثابت اضافه کنید
این مرحله فقط در صورتی لازم است که قبلاً یک مجموعه دارایی گروه مکان ثابت ایجاد کرده باشید.
- از گزارش
asset_set_assetبرای دریافت نام منابع داراییهایی که به طور خودکار برای مجموعه داراییهای همگامسازی مکان قبلاً ایجاد شده تولید شدهاند، استفاده کنید. از فیلتر کردن برای بازیابی فقط داراییهایی که میخواهید استفاده کنید. - آنها را با استفاده از
AssetSetAssetService.MutateAssetSetAssetsبه مجموعه داراییهای گروه مکان استاتیک اضافه کنید.
مدیریت شناسههای مکان نمایه کسبوکار
وقتی از یک business_profile_location_set و فیلتر روی listing_id_filters که از وبسایت یا 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);
}
پی اچ پی
/**
* 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;
}
}