Skip to main content

UA | Universal Analytics

Traffic sources: dimensions & metrics

The most important traffic sources dimensions and metrics for GA360 BigQuery export, like source / medium, keyword, default channel grouping, full referrer and campaign.

💡
This article is about GA3 - Universal Analytics

This example query contains all following Google Analytics traffic sources dimensions and metrics. If you only need one dimension or metric, look at the -- comments in the example query and copy the part you need from the select clause. Make sure that you also add any additional conditions (in the from, where, group by and order by) that are necessary to calculate the results correctly.

Traffic sources dimensions

  • referral path
  • full referrer
  • default channel grouping
  • campaign
  • source
  • medium
  • source / medium
  • keyword
  • ad content
  • social network
  • social source referral
  • campaign code

Traffic sources metrics

-

Example query

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