Yer öğesi

Diğer öğelerin aksine, yer öğeleri, bir öğe kümesi oluşturduktan sonra Google Ads API tarafından otomatik olarak oluşturulur. Öncelikle bir konum senkronizasyonu öğe kümesi oluşturun ve bunu müşteriye ekleyin. Ardından, bir kampanya veya reklam grubu için öğe kümesindeki yer öğelerinin bir alt kümesini seçmeniz gerekiyorsa bir yer grubu öğe kümesi oluşturup kampanyaya veya reklam grubuna ekleyin.

Konum senkronizasyonu öğe kümesi oluşturma ve bunu müşteriye ekleme

  1. Konum senkronizasyonu öğe kümesi oluşturun.
  2. CustomerAssetSetService kullanarak bir müşteriye ekleyin.

Yer senkronizasyonu öğe kümesi oluşturma

  1. Yeni bir AssetSet oluşturun.
    1. type değerini LOCATION_SYNC olarak ayarlayın.
    2. location_set öğesini yeni bir LocationSet olarak ayarlayın.
  2. Yeni LocationSet sürümünde:

    1. Kullanım alanınıza göre location_ownership_type ayarını yapın:
      • İşletme konumunun sahibiyseniz bunu BUSINESS_OWNER olarak ayarlayın.
      • İşletmenin bulunduğu konumun sahibi siz değilseniz ancak ürünlerinizi orada satıyorsanız bu özelliği AFFILIATE olarak ayarlayın.
    2. Kullanım alanınıza göre source oneof alanını ayarlayın:

      • business_profile_location_set seçeneğini belirleyin. Bu seçenek, Google İşletme Profili hesabınızdaki konumlarınızla senkronize etmek istediğinizde kullanılır.

        Google Ads'i bir Google İşletme Profili hesabına bağlamak için BusinessProfileLocationSet oluşturduğunuzda, http_authorization_token alanına bir OAuth 2.0 erişim jetonu sağlamanız gerekir. Bu jeton, Google Ads'in belirtilen Google İşletme Profili'ndeki konum verilerine erişmesine izin verdiğinizi kanıtlar.

        Jeton aşağıdaki koşulları karşılamalıdır:

        • Bu, email_address alanında e-posta adresi sağlanan Google Hesabı (kullanıcı veya hizmet hesabı) için oluşturulmalıdır.BusinessProfileLocationSet
        • Bu hesap, Google İşletme Profili'ndeki işletme konumlarını okumak için yeterli izinlere sahip olmalıdır.
        • OAuth 2.0 jetonu, https://www.googleapis.com/auth/business.manage kapsamıyla alınmalıdır.

        OAuth 2.0 erişim jetonu oluşturma hakkında ayrıntılı talimatlar için Google API'lerine Erişmek İçin OAuth 2.0'ı Kullanma başlıklı makaleyi inceleyin.

      • Belirli zincir kimliklerindeki konumlarla senkronize etmek istiyorsanız chain_location_set değerini ayarlayın.

      • Yer kimliklerini kullanarak konumları manuel olarak eklemek istiyorsanız maps_location_set seçeneğini ayarlayın.

Bu adımları tamamladıktan sonra Google Ads API, yer öğeleri oluşturur ve bunları, AssetSetAssetService kullanarak manuel olarak yaptığınızda olduğu gibi, sizin için oluşturulan konum senkronizasyonu öğe kümesine ekler. Bunları statik konum grubu öğe kümelerine manuel olarak eklemek istemediğiniz sürece değiştirmeniz gerekmez.

Bir müşteri için yalnızca bir etkin konum senkronizasyonu öğe kümesi (status ENABLED) olabilir. Farklı bir türde yer senkronizasyonu öğe grubu oluşturmanız gerekiyorsa önce mevcut öğe grubunu kaldırın.

Konum senkronizasyonu öğe kümesini bir müşteriye bağlama

Önceki bölümde ayarlanan konum senkronizasyonu öğe grubunu müşterinize eklemek için CustomerAssetSetService.MutateCustomerAssetSets kullanın.

(İsteğe bağlı) Yer grupları öğe kümesi oluşturup bir kampanyaya veya reklam grubuna ekleme

Yer grubu öğe kümesi yalnızca yer öğelerinin bir alt kümesini seçmeniz gerekiyorsa zorunludur. Bunun nedeni, kampanyaların ve reklam gruplarının yer öğelerini müşteri düzeyinden devralmasıdır.

Yer grubu öğe kümeleri, location_sync öğe kümesinin yer öğelerinin bir alt kümesini içerir. Google İşletme Profili'nin bazı özelliklerinden (ör. etiketlere göre filtreleme) veya zincir kimliklerinden ve zincir konumlarından yararlanarak dinamik olarak bir yer grubu öğe kümesi oluşturabilirsiniz. Alternatif olarak, statik bir konum grubu öğe kümesi de oluşturabilirsiniz.

  1. Konum grupları öğe kümesi oluşturun. Konum grubu öğe kümesi dinamik veya statik olabilir.
  2. İhtiyacınıza bağlı olarak öğe kümesini bir kampanyaya veya reklam grubuna ekleyin.
  3. (İsteğe bağlı) Daha önce oluşturulan öğeleri yeni oluşturulan statik konum grubu öğe kümesine ekleyin.

Belirli bir müşteri için birden fazla dinamik veya statik konum grubu öğe grubu oluşturabilirsiniz.

Konum grupları öğe kümesi oluşturma

Yeni bir AssetSet oluşturun ve location_group_parent_asset_set_id değerini, daha önce oluşturulan konum senkronizasyonu öğe kümesinin kimliği olarak ayarlayın.

Ardından, dinamik veya statik bir yer grubu öğe kümesi oluşturmak isteyip istemediğinize bağlı olarak bazı alanları ayarlayın.

Dinamik öğe grupları

LocationSet içinde ayarladığınız alana bağlı olarakLocationSet, alanları aşağıdaki kurala göre ayarlayın:

Aşağıdaki alanı ayarlarsanız Ardından tür Bu alanı asset_set_source oneof alanı olarak ayarlayın.
business_profile_location_set BUSINESS_PROFILE_DYNAMIC_LOCATION_GROUP business_profile_location_group
chain_location_set CHAIN_DYNAMIC_LOCATION_GROUP chain_location_group

Konum senkronizasyonu öğe kümesi oluştururken maps_location_set ayarını yaparsanız dinamik konum öğe kümesi oluşturamazsınız. Bunun nedeni, yer kimliklerine göre konumları manuel olarak eklemeniz ve bu tür konumlar için kullanabileceğiniz filtreleme özelliklerinin olmamasıdır.

Statik öğe grupları

type öğesini STATIC_LOCATION_GROUP olarak ayarlayın. LocationSet içinde hangi alanları (business_profile_location_set, chain_location_set veya maps_location_set) ayarladığınızdan bağımsız olarak, her tür konum senkronizasyonu öğe grubu için statik konum grubu öğe kümeleri oluşturabilirsiniz.

Statik yer grubu öğe kümeleri için oluşturulan yer öğelerini yer grubu öğe kümelerine manuel olarak eklemeniz gerekir.

Öğe kümesini bir kampanyaya veya reklam grubuna ekleme

CampaignAssetSetService.MutateCampaignAssetSets yer grubu öğe kümesini kampanyanıza eklemek için kullanın.

Alternatif olarak, yer grubu öğe kümesini bir reklam grubuna eklemek istiyorsanız AdGroupAssetSetService.MutateAdGroupAssetSets simgesini kullanın.

(İsteğe bağlı) Yer öğelerini statik yer grubu öğe kümesine ekleyin.

Bu adım yalnızca daha önce statik konum grubu öğe kümesi oluşturduysanız gereklidir.

  1. asset_set_asset raporunu kullanarak daha önce oluşturulan konum senkronizasyonu öğe kümesi için otomatik olarak oluşturulan öğelerin kaynak adlarını getirin. Yalnızca istediğiniz öğeleri almak için filtreleme özelliğini kullanın.
  2. AssetSetAssetService.MutateAssetSetAssets simgesini kullanarak bunları statik yer grubu öğe kümesine ekleyin.

İşletme Profili yer kodlarını yönetme

business_profile_location_set kullandığınızda ve İşletme Profili web sitesinden veya API'den alınan listing_id_filters üzerinde filtre uyguladığınızda bu sayısal değerleri uint64 türünden int64 türüne dönüştürmeniz gerekebilir. Kodunuz, listing_id_filters[] yinelenen alanına eklenirken İşletme Profili yer kodunuzun aralık dışında olduğunu belirten bir çalışma zamanı hatası oluşturuyorsa kodu aşağıdaki örneklerden herhangi birini kullanarak dönüştürmeniz gerekir:

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;
  }
}