Yer öğesi

Diğer öğelerin aksine, yer öğeleri bir öğe kümesi oluşturmanızın ardından 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.

Yer 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.

Konum senkronizasyonu öğe kümesi oluşturma

  1. Yeni bir AssetSet oluşturun.
    1. type değerini LOCATION_SYNC olarak ayarlayın.
    2. location_set değerini yeni bir LocationSet olarak ayarlayın.
  2. Yeni LocationSet'da:

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

      • Google İşletme Profili hesabınızdaki konumlarınızla senkronize etmek istiyorsanız business_profile_location_set değerini ayarlayın.

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

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

        • Bu anahtar, e-posta adresi BusinessProfileLocationSet'nin email_address alanında belirtilen Google Hesabı (kullanıcı veya hizmet hesabı) için oluşturulmalıdır.
        • Bu hesabın, Google İşletme Profili'ndeki işletme konumlarını okumak için yeterli izinlere sahip olması gerekir.
        • 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.

      • Belirtilen 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ı sizin için oluşturulan yer senkronizasyonu öğe kümesine ekler. Bu işlem, AssetSetAssetService kullanarak manuel olarak yaptığınız işleme benzer. Statik bir yer grubu öğe kümesine manuel olarak eklemek istemediğiniz sürece bunları değiştirmeniz gerekmez.

Bir müşteri için yalnızca bir etkin konum senkronizasyonu öğe kümesi olabilir ve bu öğe kümesinde status, ENABLED olarak ayarlanmalıdır. Farklı türde bir konum senkronizasyonu öğe kümesi oluşturmanız gerekiyorsa önce mevcut öğe kümesini kaldırın.

Konum senkronizasyonu öğe kümesini 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 kümesi oluşturma ve bunu bir kampanyaya veya reklam grubuna ekleme

Yer grubu öğe kümesi, yalnızca yer öğelerinin bir alt kümesini seçmeniz gerekiyorsa gereklidir. 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 kümesi oluşturabilirsiniz. Alternatif olarak, statik bir şekilde yer grubu öğe kümesi oluşturabilirsiniz.

  1. Yer grupları öğe kümesi oluşturun. Yer 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 grubuna ekleyin.

Belirli bir müşteri için birden fazla dinamik veya statik yer grupları öğe kümesi oluşturabilirsiniz.

Yer 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ğine 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 kümeleri

LocationSet bölümünde ayarladığınız alana bağlı olarak, 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

Yer senkronizasyonu öğe kümesini oluştururken maps_location_set değerini ayarlarsanız dinamik yer grubu öğe kümesi oluşturamazsınız. Bunun nedeni, konumları yer kimliklerine göre manuel olarak eklemiş olmanızdır. Bu tür konumlar için kullanabileceğiniz filtreleme özellikleri yoktur.

Statik öğe kümeleri

type değerini STATIC_LOCATION_GROUP olarak ayarlayın. LocationSet içinde hangi alanları (business_profile_location_set, chain_location_set veya maps_location_set) ayarlarsanız ayarlayın, her tür konum senkronizasyonu öğe seti için statik yer grubu öğe setleri 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 ekleyin.

CampaignAssetSetService.MutateCampaignAssetSets simgesini kullanarak yer grubu öğe kümesini kampanyanıza ekleyin.

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 grupları öğe kümesine ekleyin.

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

  1. asset_set_asset raporunu kullanarak daha önce oluşturulan konum senkronizasyonu öğe kümesinde 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 kullanarak bunları statik yer grubu öğe kümesine ekleyin.

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

business_profile_location_set kullanıp İşletme Profili web sitesinden veya API'sinden alınan listing_id_filters değerlerini filtrelediğinizde, bu sayısal değerleri uint64 türünden int64 türüne dönüştürmeniz gerekebilir. Kodunuz, İşletme Profili yer kodunuzu listing_id_filters[] yinelenen alanına eklerken aralık dışında olduğuna dair bir çalışma zamanı hatası oluşturuyorsa aşağıdaki örneklerden birini kullanarak kodu dönüştürmeniz gerekebilir:

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 < 0 or 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 < 0 || 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.
  elsif 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 < 0 || $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.
  } elsif ($business_profile_location_id >= 2**63) {
    return -1 * (2**64 - $business_profile_location_id);
  } else {
    return $business_profile_location_id;
  }
}