على عكس مواد العرض الأخرى، يتم إنشاء مواد عرض المواقع الجغرافية تلقائيًا بواسطة Google Ads API بعد إنشاء مجموعة مواد عرض. عليك أولاً إنشاء مجموعة مواد عرض لمزامنة المواقع الجغرافية وربطها بالعميل. بعد ذلك، إذا كنت بحاجة إلى اختيار مجموعة فرعية من مواد عرض المواقع الجغرافية في مجموعة مواد العرض لحملة أو مجموعة إعلانية، عليك إنشاء مجموعة مواد عرض لمجموعة المواقع الجغرافية وربطها بالحملة أو المجموعة الإعلانية.
إنشاء مجموعة مواد عرض لمزامنة المواقع الجغرافية وربطها بالعميل
- عليك إنشاء مجموعة مواد عرض لمزامنة المواقع الجغرافية.
- يمكنك ربطها بعميل باستخدام
CustomerAssetSetService.
إنشاء مجموعة مواد عرض لمزامنة المواقع الجغرافية
- عليك إنشاء
AssetSetجديد.- اضبط
typeعلىLOCATION_SYNC. - اضبط
location_setعلىLocationSetجديد.
- اضبط
في
LocationSetالجديد،- اضبط
location_ownership_typeاستنادًا إلى حالة الاستخدام:- اضبطها على
BUSINESS_OWNERإذا كنت تملك الموقع الجغرافي للنشاط التجاري. - اضبطها على
AFFILIATEإذا كنت لا تملك الموقع الجغرافي للنشاط التجاري، ولكنك تبيع منتجاتك فيه.
- اضبطها على
اضبط حقل
sourceoneof استنادًا إلى حالة الاستخدام:اضبط
business_profile_location_setإذا كنت تريد المزامنة مع مواقعك الجغرافية في حسابك على "الملف التجاري على Google".عند إنشاء
BusinessProfileLocationSetلربط "إعلانات Google" بحساب على "الملف التجاري على Google"، يجب تقديم رمز دخول OAuth 2.0 في حقلhttp_authorization_token. يعمل هذا الرمز كدليل على أنّك تسمح لخدمة "إعلانات Google" بالوصول إلى بيانات الموقع الجغرافي من "الملف التجاري على Google" المحدّد.يجب أن يستوفي الرمز المتطلبات التالية:
- يجب إنشاء الرمز لحساب Google (حساب مستخدم أو حساب خدمة) الذي يتم تقديم عنوان بريده الإلكتروني في حقل
email_addressفيBusinessProfileLocationSet. - يجب أن يملك هذا الحساب أذونات كافية لقراءة المواقع الجغرافية للأنشطة التجارية ضمن "الملف التجاري على Google".
- يجب الحصول على رمز OAuth 2.0 باستخدام النطاق
https://www.googleapis.com/auth/business.manage.
للحصول على تعليمات مفصّلة حول كيفية إنشاء رمز دخول OAuth 2.0، يُرجى الاطّلاع على مقالة استخدام OAuth 2.0 للوصول إلى Google APIs.
- يجب إنشاء الرمز لحساب Google (حساب مستخدم أو حساب خدمة) الذي يتم تقديم عنوان بريده الإلكتروني في حقل
اضبط
chain_location_setإذا كنت تريد المزامنة مع المواقع الجغرافية في معرّفات السلسلة المحدّدة.اضبط
maps_location_setإذا كنت تريد إضافة المواقع الجغرافية يدويًا باستخدام معرّفات الأماكن.
- اضبط
بعد إكمال هذه الخطوات، ينشئ Google Ads API مواد عرض
المواقع الجغرافية ويضيفها إلى مجموعة مواد عرض مزامنة المواقع الجغرافية التي أنشأتها، على غرار
ما يحدث عند إجراء ذلك يدويًا باستخدام
AssetSetAssetService. لست بحاجة إلى
تعديلها إلا إذا أردت إضافتها يدويًا إلى مجموعات مواد عرض المواقع الجغرافية الثابتة.
يمكن أن تكون هناك مجموعة مواد عرض واحدة فقط لمزامنة المواقع الجغرافية مفعّلة
(status هي
ENABLED) يمكن أن تكون موجودة
لعميل معيّن. إذا كنت بحاجة إلى إنشاء نوع مختلف من مجموعة مواد عرض مزامنة المواقع الجغرافية، عليك إزالة المجموعة الحالية أولاً.
ربط مجموعة مواد عرض مزامنة المواقع الجغرافية بعميل
استخدِم
CustomerAssetSetService.MutateCustomerAssetSets
لربط مجموعة مواد عرض مزامنة المواقع الجغرافية في القسم السابق بعميلك.
(اختياري) إنشاء مجموعة مواد عرض لمجموعة المواقع الجغرافية وربطها بحملة أو مجموعة إعلانية
لا تكون مجموعة مواد عرض مجموعة المواقع الجغرافية ضرورية إلا إذا كنت بحاجة إلى اختيار مجموعة فرعية من مواد عرض المواقع الجغرافية. يرجع ذلك إلى أنّ الحملات والمجموعات الإعلانية تكتسب مواد عرض المواقع الجغرافية من مستوى العميل.
تحتوي مجموعات مواد عرض مجموعة المواقع الجغرافية على مجموعة فرعية من مواد عرض المواقع الجغرافية في مجموعة مواد عرض مزامنة المواقع الجغرافية. يمكنك إنشاء مجموعة مواد عرض لمجموعة المواقع الجغرافية بشكلٍ ديناميكي من خلال الاستفادة من بعض ميزات "الملف التجاري على Google" (مثل الفلترة حسب التصنيفات) أو معرّفات السلسلة ومواقع السلسلة. بدلاً من ذلك، يمكنك إنشاء مجموعة مواد عرض لمجموعة المواقع الجغرافية بشكلٍ ثابت.
- عليك إنشاء مجموعة مواد عرض لمجموعة المواقع الجغرافية. يمكن أن تكون مجموعة مواد عرض مجموعة المواقع الجغرافية ديناميكية أو ثابتة.
- عليك ربط مجموعة مواد العرض بحملة باستخدام أو بمجموعة إعلانية، حسب حاجتك.
- (اختياري) أضِف مواد العرض التي تم إنشاؤها سابقًا إلى مجموعة مواد عرض مجموعة المواقع الجغرافية الثابتة التي تم إنشاؤها حديثًا.
بالنسبة إلى عميل معيّن، يمكنك إنشاء عدّة مجموعات مواد عرض لمجموعة المواقع الجغرافية، سواء كانت ديناميكية أو ثابتة.
إنشاء مجموعة مواد عرض لمجموعة المواقع الجغرافية
عليك إنشاء AssetSet جديد وضبط
location_group_parent_asset_set_id على رقم تعريف مجموعة مواد عرض مزامنة المواقع الجغرافية التي تم إنشاؤها سابقًا.
بعد ذلك، اضبط بعض الحقول استنادًا إلى ما إذا كنت تريد إنشاء مجموعة مواد عرض ديناميكية أو ثابتة لمجموعة المواقع الجغرافية.
مجموعات مواد العرض الديناميكية
استنادًا إلى الحقل الذي تضبطه في LocationSet، اضبط
الحقول استنادًا إلى القاعدة التالية:
| إذا ضبطت الحقل التالي | ثم اضبط النوع على | واضبط هذا الحقل كحقل asset_set_source oneof field |
|---|---|---|
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.
بالنسبة إلى مجموعات مواد عرض مجموعة المواقع الجغرافية الثابتة، عليك إضافة مواد عرض المواقع الجغرافية التي تم إنشاؤها يدويًا إلى مجموعات مواد عرض مجموعة المواقع الجغرافية sets.
ربط مجموعة مواد العرض بحملة أو مجموعة إعلانية
استخدِم
CampaignAssetSetService.MutateCampaignAssetSets
لربط مجموعة مواد عرض مجموعة المواقع الجغرافية بحملتك.
بدلاً من ذلك، استخدِم
AdGroupAssetSetService.MutateAdGroupAssetSets
إذا كنت تريد ربط مجموعة مواد عرض مجموعة المواقع الجغرافية بـ
مجموعة إعلانية بدلاً من ذلك.
(اختياري) إضافة مواد عرض المواقع الجغرافية إلى مجموعة مواد عرض مجموعة المواقع الجغرافية الثابتة
لا تكون هذه الخطوة مطلوبة إلا إذا أنشأت مجموعة مواد عرض ثابتة لمجموعة المواقع الجغرافية سابقًا.
- استخدِم تقرير
asset_set_assetلجلب أسماء موارد مواد العرض التي تم إنشاؤها تلقائيًا لـ مجموعة مواد عرض مزامنة المواقع الجغرافية التي تم إنشاؤها سابقًا. استخدِم الفلترة لاسترداد مواد العرض التي تريدها فقط. - أضِفها إلى مجموعة مواد عرض مجموعة المواقع الجغرافية الثابتة باستخدام
AssetSetAssetService.MutateAssetSetAssets.
إدارة معرّفات المواقع الجغرافية في "الملف التجاري على Google"
عند استخدام business_profile_location_set والفلترة حسب
listing_id_filters
التي يتم استردادها من الموقع الإلكتروني أو واجهة برمجة التطبيقات الخاصة بـ "الملف التجاري على Google"، قد يكون من الضروري
تحويل هذه القيم الرقمية من النوع uint64 إلى int64. إذا كان الرمز البرمجي يعرض خطأ في وقت التشغيل يشير إلى أنّ معرّف الموقع الجغرافي في "الملف التجاري على Google" خارج النطاق عند إضافته إلى الحقل المتكرّر 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);
}
#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;
}
}