BigQuery Abfrage für Google Analytics (UA): Datum und Zeit: Dimensionen

Diese Beispielabfrage enthält alle folgenden Google Analytics Datums- und Zeitdimensionen. Wenn Sie nur eine Dimension oder Metrik benötigen, sehen Sie sich die — Kommentare in der Beispielabfrage an und kopieren Sie den Teil, den Sie benötigen, aus der Select-Klausel. Stellen Sie sicher, dass Sie auch alle zusätzlichen Bedingungen (in der from-, where-, group by- und order by-Klausel) hinzufügen, die zur korrekten Berechnung der Ergebnisse erforderlich sind.

Zeit Dimensionen:

  • date
  • year
  • iso year
  • month of year
  • month of the year
  • week of year
  • week of the year
  • iso week of the year
  • iso week of iso year
  • day of the month
  • day of week
  • day of week name
  • hour
  • minute
  • hour of day
  • date hour and minute
select
  -- date (dimension)
  date as date,
  -- year (dimension)
  format_date('%Y', parse_date("%Y%m%d",date)) as year,
  -- iso year (dimension)
  format_date('%G', parse_date("%Y%m%d",date)) as iso_year,
  -- month of year (dimension)
  format_date('%Y%m', parse_date("%Y%m%d",date)) as month_of_year,
  -- month of the year (dimension)
  format_date('%m', parse_date("%Y%m%d",date)) as month_of_the_year,
  -- week of year (dimension)
  format_date('%Y%U', parse_date("%Y%m%d",date)) as week_of_year,
  -- week of the year (dimension)
  format_date('%U', parse_date("%Y%m%d",date)) as week_of_the_year,
  -- iso week of the year (dimension)
  format_date('%W', parse_date("%Y%m%d",date)) as iso_week_of_the_year,
  -- iso week of iso year (dimension)
  format_date('%G%W', parse_date("%Y%m%d",date)) as iso_week_of_iso_year,
  -- day of the month (dimension)
  format_date('%d', parse_date("%Y%m%d",date)) as day_of_the_month,
  -- day of week (dimension)
  format_date('%w', parse_date("%Y%m%d",date)) as day_of_week,
  -- day of week name (dimension)
  format_date('%A', parse_date("%Y%m%d",date)) as day_of_week_name,
  -- hour of day(dimension)
  concat(date,cast(extract (hour from timestamp_seconds(visitstarttime)) as string)) as hour_of_day,
  -- hour (dimension)
  format("%02d",extract (hour from timestamp_seconds(visitstarttime))) as hour,
  -- minute (dimension)
  format("%02d",extract (minute from timestamp_seconds(visitstarttime))) as minute,
  -- date hour and minute (dimension)
  concat(concat(date,format("%02d",extract (hour from timestamp_seconds(visitstarttime))),format("%02d",extract(minute from timestamp_seconds(visitstarttime))))) as date_hour_and_minute
from
  `bigquery-public-data.google_analytics_sample.ga_sessions_20160801`
where
  totals.visits = 1
order by
  date_hour_and_minute desc