Yer öğesi

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

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

  1. Yer senkronizasyonu öğe grubu oluşturun.
  2. CustomerAssetSetService kullanarak bir müşteriye ekleyin.

Yer senkronizasyonu öğe grubu 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'da,
    1. Kullanım alanınıza göre location_ownership_type ayarını yapın:
      • İşletme konumunun sahibiyseniz bunu BUSINESS_OWNER olarak ayarlayın.
      • İşletme konumunun 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 ayarlarsanız Google İşletme Profili hesabınızdaki konumlarınızla senkronize edebilirsiniz.
      • 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, konum öğeleri oluşturur ve bunları, AssetSetAssetService kullanarak manuel olarak yaptığınızda olduğu gibi, sizin için oluşturulan konum senkronizasyonu öğe grubuna 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 grubu (status ENABLED) olabilir. Farklı bir türde konum senkronizasyonu öğe grubu oluşturmanız gerekiyorsa önce mevcut öğe grubunu kaldırın.

Konum senkronizasyonu öğe grubunu bir müşteriye ekleme

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

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

Yer grubu öğe grubu 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, yer senkronizasyonu öğ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 grubu oluşturabilirsiniz. Alternatif olarak, statik bir konum grubu öğe grubu da oluşturabilirsiniz.

  1. Konum grubu öğe grubu oluşturun. Konum grubu öğe grubu dinamik veya statik olabilir.
  2. İhtiyacınıza bağlı olarak öğe setini 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 grubu öğe grubu oluşturma

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

Ardından, dinamik veya statik bir yer grubu öğe grubu 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 type değerini 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 grubu oluştururken maps_location_set seçeneğini ayarlarsanız dinamik konum grubu öğe grubu oluşturamazsınız. Bunun nedeni, yer kimlikleriyle 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 grubunu bir kampanyaya veya reklam grubuna ekleme

CampaignAssetSetService.MutateCampaignAssetSets Yer grubu öğe grubunu kampanyanıza eklemek için kullanın.

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

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

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

  1. asset_set_asset raporunu kullanarak daha önce oluşturulmuş konum senkronizasyonu öğe grubunda 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 grubuna ekleyin.

İşletme Profili konum kimliklerini 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[] tekrarlanan alanına eklenirken İşletme Profili konum kimliğinizin 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;
  }
}