Diese Beispielabfrage enthält alle folgenden Dimensionen der Google Analytics-Traffic-Quelle. Wenn Sie nur eine Dimension 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.
Traffic-Quellen-Dimensionen:
- referral path
- full referrer
- default channel grouping
- campaign
- source
- medium
- source / medium
- keyword
- ad content
- social network
- social source referral
- campaign code
select
-- referral path (dimension)
trafficsource.referralpath as referral_path,
-- full referrer (dimension)
concat(trafficsource.source,trafficsource.referralpath) as full_referrer,
-- default channel grouping
channelgrouping as default_channel_grouping,
-- campaign (dimension)
trafficsource.campaign as campaign,
-- source (dimension)
trafficsource.source as source,
-- medium (dimension)
trafficsource.medium as medium,
-- source / medium (dimension)
concat(trafficsource.source," / ",trafficsource.medium) as source_medium,
-- keyword (dimension)
trafficsource.keyword as keyword,
-- ad content (dimension)
trafficsource.adcontent as ad_content,
-- social network (dimension)
(select social.socialnetwork from unnest(hits) group by social.socialnetwork) as social_network,
-- social source (dimension)
(select social.hassocialsourcereferral from unnest(hits) group by social.hassocialsourcereferral) as social_source,
-- campaign code (dimension)
trafficsource.campaigncode as campaign_code
from
`bigquery-public-data.google_analytics_sample.ga_sessions_20160801`
where
totals.visits = 1