Migrare il report Più venduti

Questo documento ti aiuta a eseguire la migrazione dalla versione precedente del report Più venduti alla versione più recente. La versione precedente del report che esporta le tabelle BestSellers_TopBrands_, BestSellers_TopProducts_ e BestSellers_TopProducts_Inventory_ verrà ritirata il 1° settembre 2025.

Il nuovo report Più venduti offre quanto segue:

Tabelle esportate dai report precedenti e nuovi

La seguente tabella confronta le tabelle esportate dai report precedenti e nuovi:

Report precedente Nuovo report
BestSellers_TopBrands BestSellersBrandWeekly e BestSellersBrandMonthly
BestSellers_TopProducts BestSellersProductClusterWeekly e BestSellersProductClusterMonthly
BestSellers_TopProducts_Inventory BestSellersEntityProductMapping

Il report precedente contiene una singola aggregazione dei dati Più venduti in un intervallo di tempo non specificato. Il nuovo report fornisce le aggregazioni settimanali e mensili più recenti di questi dati al momento della richiesta.

Confrontare BestSellers_TopBrands con BestSellersBrandWeekly e BestSellersBrandMonthly

La seguente tabella ti aiuta a identificare i campi della tabella BestSellers_TopBrands che hanno sostituzioni equivalenti nelle tabelle BestSellersBrandWeekly e BestSellersBrandMonthly. Le sostituzioni per alcuni campi della tabella precedente non sono disponibili.

BestSellers_TopBrands (precedente) BestSellersBrandWeekly e BestSellersBrandMonthly (nuovo)
rank_timestamp _PARTITIONDATE e _PARTITIONTIME
brand brand
google_brand_id
ranking_category category_id
ranking_category_path.locale
ranking_category_path.name
ranking_country country_code
rank_id
rank rank
previous_rank previous_rank
relative_demand.bucket relative_demand
relative_demand.min
relative_demand.max
previous_relative_demand.bucket previous_relative_demand
previous_relative_demand.min
previous_relative_demand.max
relative_demand_change

Confrontare BestSellers_TopProducts con BestSellersProductClusterWeekly e BestSellersProductClusterMonthly

La seguente tabella ti aiuta a identificare i campi della tabella BestSellers_TopProducts che hanno sostituzioni equivalenti nelle tabelle BestSellersProductClusterWeekly e BestSellersProductClusterMonthly. Le sostituzioni per alcuni campi della tabella precedente non sono disponibili.

BestSellers_TopProducts (precedente) BestSellersProductClusterWeekly e BestSellersProductClusterMonthly (nuovo)
rank_timestamp _PARTITIONDATE e _PARTITIONTIME
rank_id entity_id
rank rank
previous_rank previous_rank
ranking_country country_code
ranking_category report_category_id
ranking_category_path.locale
ranking_category_path.name
relative_demand.bucket relative_demand
relative_demand.min
relative_demand.max
previous_relative_demand.bucket previous_relative_demand
previous_relative_demand.min
previous_relative_demand.max
relative_demand_change
product_title.locale
product_title.name title (singolo titolo anziché un array per ogni localizzazione)
gtins variant_gtins
google_brand_id
brand brand
google_product_category
category_l1, category_l2, category_l3, category_l4, category_l5
google_product_category_path.locale
google_product_category_path.name
price_range.min price_range.min_amount_micros
price_range.max price_range.max_amount_micros
price_range.currency price_range.currency_code
product_inventory_status
brand_inventory_status

Mappatura dell'inventario dei dati Più venduti

Nel report Più venduti precedente, i dati Più venduti vengono mappati ai dati dell'inventario del commerciante in una nuova tabella generata, utilizzando la colonna rank_id della tabella TopProducts.

Nel nuovo report Più venduti, la colonna entity_id viene esportata nelle BestSellersProductCluster tabelle, che viene mappata a tutti gli ID prodotto dell' inventario del commerciante nella BestSellersEntityProductMapping tabella.

BestSellers_TopProductsInventory (precedente) BestSellersEntityProductMapping (nuovo)
rank_id (nella tabella BestSellers_TopProducts) entity_id (nelle tabelle BestSellersProductClustersWeekly e BestSellersProductClustersMonthly)
product_id product_id
merchant_id
aggregator_id

Esempi di query

Questa sezione evidenzia le modifiche apportate alle query di esempio utilizzate per recuperare i dati Più venduti.

Esempio 1: recuperare i prodotti di punta per una determinata categoria e un determinato paese

Le seguenti query restituiscono i prodotti di punta per una determinata categoria e un determinato paese.

Utilizzare la tabella BestSellers_TopProducts (precedente)

SELECT
  rank,
  previous_rank,
  relative_demand.bucket,
  (SELECT name FROM top_products.product_title WHERE locale = 'en-US') AS product_title,
  brand,
  price_range,
  google_product_category
FROM
  `DATASET.BestSellers_TopProducts_MERCHANT_ID` AS top_products
WHERE
  _PARTITIONDATE = 'DATE' AND
  ranking_category = 267 /*Smartphones*/ AND
  ranking_country = 'US'
ORDER BY
  rank;

Utilizzare la tabella BestSellersProductClusterWeekly o BestSellersProductClusterMonthly (nuova)

SELECT
  rank,
  previous_rank,
  relative_demand,
  title AS product_title,
  brand,
  price_range,
  category_l1,
  category_l2
FROM
  `DATASET.BestSellersProductClusterWeekly_MERCHANT_ID` AS top_products
WHERE
  _PARTITIONDATE = 'DATE' AND
  report_category_id = 267 /*Smartphones*/ AND
  country_code = 'US'
ORDER BY
  rank;

Esempio 2: recuperare i prodotti di punta nel tuo inventario

Le seguenti query restituiscono un elenco dei prodotti di punta nel tuo inventario.

Utilizzare la tabella BestSellers_TopProducts (precedente)

WITH latest_top_products AS
(
  SELECT
    *
  FROM
    `DATASET.BestSellers_TopProducts_MERCHANT_ID`
  WHERE
    _PARTITIONDATE = 'DATE'
),
latest_top_products_inventory AS
(
  SELECT
    *
  FROM
    `DATASET.BestSellers_TopProducts_Inventory_MERCHANT_ID`
  WHERE
    _PARTITIONDATE = 'DATE'
)
SELECT
  top_products.rank,
  inventory.product_id,
  (SELECT ANY_VALUE(name) FROM top_products.product_title) AS product_title,
  top_products.brand,
  top_products.gtins
FROM
  latest_top_products AS top_products
INNER JOIN
  latest_top_products_inventory AS inventory
USING (rank_id);

Utilizzare la tabella BestSellersProductClusterWeekly o BestSellersProductClusterMonthly (nuova)

WITH latest_top_products AS
(
  SELECT
    *
  FROM
    `DATASET.BestSellersProductClusterWeekly_MERCHANT_ID`
  WHERE
    _PARTITIONDATE = 'DATE'
),
latest_top_products_inventory AS
(
  SELECT
    *
  FROM
    `DATASET.BestSellersEntityProductMapping_MERCHANT_ID`
  WHERE
    _PARTITIONDATE = 'DATE'
)
SELECT
  top_products.rank,
  inventory.product_id,
  top_products.title AS product_title,
  top_products.brand,
  top_products.variant_gtins
FROM
  latest_top_products AS top_products
INNER JOIN
  latest_top_products_inventory AS inventory
USING (entity_id);

Inoltre, se vuoi trovare il numero di prodotti o brand più venduti nel tuo inventario, esegui una query sulle tabelle BestSellerProductClusterWeekly o BestSellerProductClusterMonthly utilizzando le colonne product_inventory_status o brand_inventory_status. Consulta la seguente query di esempio:

SELECT
  *
FROM
  `DATASET.BestSellersProductClusterMonthly_MERCHANT_ID`
WHERE
  _PARTITIONDATE = 'DATE' AND
  product_inventory_status != 'NOT_IN_INVENTORY'
ORDER BY
  rank;

Esempio 3: recuperare i brand di punta per una determinata categoria e un determinato paese

Le seguenti query restituiscono un elenco dei brand di punta per una determinata categoria e un determinato paese.

Utilizzare la tabella BestSellers_TopBrands (precedente)

SELECT
  rank,
  previous_rank,
  brand
FROM
  `DATASET.BestSellers_TopBrands_MERCHANT_ID`
WHERE
  _PARTITIONDATE = 'DATE' AND
  ranking_category = 267 /*Smartphones*/ AND
  ranking_country = 'US'
ORDER BY
  rank;

Utilizzare la tabella BestSellersTopBrandsWeekly o BestSellersTopBrandsMonthly (nuova)

SELECT
  rank,
  previous_rank,
  brand
FROM
  `DATASET.BestSellersTopBrandsWeekly_MERCHANT_ID`
WHERE
  _PARTITIONDATE = 'DATE' AND
  report_category_id = 267 /*Smartphones*/ AND
  country_code = 'US'
ORDER BY
  rank;

Esempio 4: recuperare i prodotti dei brand di punta nel tuo inventario

Le seguenti query restituiscono un elenco dei prodotti dei brand di punta nel tuo inventario.

Utilizzare la tabella BestSellers_TopBrands (precedente)

WITH latest_top_brands AS
  (
    SELECT
      *
    FROM
      `DATASET.BestSellers_TopBrands_MERCHANT_ID`
    WHERE
      _PARTITIONDATE = 'DATE'
  ),
  latest_products AS
  (
    SELECT
      product.*,
      product_category_id
    FROM
      `DATASET.Products_MERCHANT_ID` AS product,
      UNNEST(product.google_product_category_ids) AS product_category_id,
      UNNEST(destinations) AS destination,
      UNNEST(destination.approved_countries) AS approved_country
    WHERE
      _PARTITIONDATE = 'DATE'
  )
SELECT
  top_brands.brand,
  (SELECT name FROM top_brands.ranking_category_path
  WHERE locale = 'en-US') AS ranking_category,
  top_brands.ranking_country,
  top_brands.rank,
  products.product_id,
  products.title
FROM
  latest_top_brands AS top_brands
INNER JOIN
  latest_products AS products
ON top_brands.google_brand_id = products.google_brand_id AND
   top_brands.ranking_category = product_category_id AND
   top_brands.ranking_country = products.approved_country;

Utilizzare la tabella BestSellersTopBrandsWeekly o BestSellersTopBrandsMonthly (nuova)

WITH latest_top_brands AS
  (
    SELECT
      *
    FROM
      `DATASET.BestSellersBrandMonthly_MERCHANT_ID`
    WHERE
      _PARTITIONDATE = 'DATE'
  ),
  latest_products AS
  (
    SELECT
      product.*,
      product_category_id
    FROM
      `DATASET.Products_MERCHANT_ID` AS product,
      UNNEST(product.google_product_category_ids) AS product_category_id,
      UNNEST(destinations) AS destination,
      UNNEST(destination.approved_countries) AS approved_country
    WHERE
      _PARTITIONDATE = 'DATE'
  )
SELECT
  top_brands.brand,
  - The full category name is not supported in the new BestSellersTopBrands tables.
  - (SELECT name FROM top_brands.ranking_category_path
  - WHERE locale = 'en-US') AS ranking_category,
  top_brands.category_id,
  top_brands.rank,
  products.product_id,
  products.title
FROM
  latest_top_brands AS top_brands
INNER JOIN
  latest_products AS products
ON top_brands.brand = products.brand AND
   top_brands.category_id = product_category_id AND
   top_brands.country_code = products.approved_country;

In queste query, sostituisci quanto segue:

  • DATASET: il nome del set di dati
  • MERCHANT_ID: l'ID account commerciante
  • DATE: la data nel formato YYYY-MM-DD

Passaggi successivi