Erstellung des Ecommerce-Transaktions-Berichtes in Big Query mit Universal Analytics Daten

Im Ecommerce-Transaktions-Bericht finden Sie Daten über die Leistung Ihrer E-Commerce-Aktivitäten, segmentiert nach Transaktions-ID.

-- this query will not return quantity data as there is no standard ecommerce product data available in the sample data set

select
  hits.transaction.transactionid,
  ifnull(sum(hits.transaction.transactionrevenue)/1000000,0) as revenue,
  ifnull(sum(hits.transaction.transactiontax)/1000000,0) as tax,
  ifnull(sum(hits.transaction.transactionshipping)/1000000,0) as shipping,
  ifnull(sum(hits.item.itemquantity),0) as quantity
from
  `bigquery-public-data.google_analytics_sample.ga_sessions_20160801`,
  unnest(hits) as hits
where
  totals.visits = 1
  and hits.transaction.transactionid is not null
group by
  transactionid
order by
  revenue desc