Acquisition and traffic quality

How this LookML project measures acquisition quality

Which channels, referers and landing pages bring sessions that engage, rather than sessions that bounce?

Short answer

Trust: Inferred

Compare channels on engagement, not on session counts. This project maps raw referers to five channels and ranks landing pages by bounce rate and events per session side by side. Watch the catch-all: anything it does not recognise is labelled direct, so broken tracking looks like brand traffic.

Decision it supports: Where to spend acquisition budget and which landing pages to fix.

What to measure

Sessions

Trust: Source-defined

Distinct pairs of visitor cookie and session index.

Defined as sessions.count

COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx)Trust: Translated

Show the SQL: Sessions
Redshift SQLTrust: Translated
COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx)

Translated to Redshift SQL from user_sessions.view.lookml L105-106, L285-288. Not run against a warehouse.

Show the original LookML: user_sessions.view.lookml L285-288
dating_platform/user_sessions.view.lookmlL285-288
    sql: ${TABLE}.br_features_windowsmedia  - dimension: browser_supports_cookies    sql: ${TABLE}.br_cookies  - measure: count    type: count_distinct    sql: ${session_id}    detail: individual_detail*  - measure: visitors_count    type: count_distinct    sql: ${user_id}

dating-platform, user_sessions.view.lookml, lines 285-288

Bounce rate

Trust: Source-defined

Share of sessions with exactly one event.

Defined as sessions.bounce_rate

COUNT(DISTINCT CASE WHEN sessions.number_of_events = 1 THEN sessions.domain_userid || '-' || sessions.domain_sessionidx END)/NULLIF(COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx),0)::REALTrust: Translated

Show the SQL: Bounce rate
Redshift SQLTrust: Translated
COUNT(DISTINCT CASE WHEN sessions.number_of_events = 1 THEN sessions.domain_userid || '-' || sessions.domain_sessionidx END)/NULLIF(COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx),0)::REAL

Translated to Redshift SQL from user_sessions.view.lookml L105-106, L163-165, L285-288, L294-303. Not run against a warehouse.

Show the original LookML: user_sessions.view.lookml L300-303
dating_platform/user_sessions.view.lookmlL300-303
    filters:      bounce: true    detail: detail*  - measure: bounce_rate    type: number    decimals: 2    sql: ${bounced_sessions_count}/NULLIF(${count},0)::REAL  - measure: sessions_from_new_visitors_count    type: count_distinct    sql: ${session_id}

dating-platform, user_sessions.view.lookml, lines 300-303

Events per session

Trust: Source-defined

All events divided by sessions, a rough measure of depth.

Defined as sessions.events_per_session

SUM(sessions.number_of_events)/NULLIF(COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx),0)::REALTrust: Translated

Show the SQL: Events per session
Redshift SQLTrust: Translated
SUM(sessions.number_of_events)/NULLIF(COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx),0)::REAL

Translated to Redshift SQL from user_sessions.view.lookml L105-106, L285-288, L322-328. Not run against a warehouse.

Show the original LookML: user_sessions.view.lookml L325-328
dating_platform/user_sessions.view.lookmlL325-328
  - measure: events_count    type: sum    sql: ${TABLE}.number_of_events  - measure: events_per_session    type: number    decimals: 2    sql: ${events_count}/NULLIF(${count},0)::REAL  - measure: events_per_visitor    type: number    decimals: 2

dating-platform, user_sessions.view.lookml, lines 325-328

Channel

Trust: Source-defined

The raw referer medium mapped to email, search, social, other website or direct.

Defined as sessions.referer_medium

Show the SQL: Channel
Redshift SQLTrust: Translated
CASE  WHEN sessions.refr_medium = 'email' THEN 'email'  WHEN sessions.refr_medium = 'search' THEN 'search'  WHEN sessions.refr_medium = 'social' THEN 'social'  WHEN sessions.refr_medium = 'unknown' THEN 'other_website'  ELSE 'direct'END

Translated to Redshift SQL from user_sessions.view.lookml L218-224. Not run against a warehouse.

Show the original LookML: user_sessions.view.lookml L218-224
dating_platform/user_sessions.view.lookmlL218-224
    sql: ${TABLE}.exit_page_path  - dimension: exit_page    sql: ${TABLE}.exit_page_host || ${TABLE}.exit_page_path  - dimension: referer_medium    sql_case:      email: ${TABLE}.refr_medium = 'email'      search: ${TABLE}.refr_medium = 'search'      social: ${TABLE}.refr_medium = 'social'      other_website: ${TABLE}.refr_medium = 'unknown'      else: direct  - dimension: referer_source    sql: ${TABLE}.refr_source  - dimension: referer_term

dating-platform, user_sessions.view.lookml, lines 218-224

Quality score per channel

Trust: Suggested

Combining bounce rate and depth into one score is a choice the project does not make.

Direct traffic

Trust: Inferred

Anything not email, search, social or unknown is labelled direct, including a NULL referer medium.

The query

Engagement by channel

Trust: Suggested

Sessions, bounce rate and events per session for each channel, built from the project's own fields. No dashboard tile asks exactly this, so the field combination is ours.

Show the SQL: engagement by channel
Redshift SQLTrust: Suggested
SELECT  CASE    WHEN sessions.refr_medium = 'email' THEN 'email'    WHEN sessions.refr_medium = 'search' THEN 'search'    WHEN sessions.refr_medium = 'social' THEN 'social'    WHEN sessions.refr_medium = 'unknown' THEN 'other_website'    ELSE 'direct'  END AS referer_medium,  COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx) AS count,  COUNT(DISTINCT CASE WHEN sessions.number_of_events = 1 THEN sessions.domain_userid || '-' || sessions.domain_sessionidx END)/NULLIF(COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx),0)::REAL AS bounce_rate,  SUM(sessions.number_of_events)/NULLIF(COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx),0)::REAL AS events_per_sessionFROM sessions  -- derived table, defined in the sourceGROUP BY 1ORDER BY count DESC

Suggested query. Fields translated to Redshift SQL from event_tracker.model.lookml L13-16 and user_sessions.view.lookml L105-106, L163-165, L218-224, L285-288, L294-303, L322-328. Not run against a warehouse.

The data behind it

Trust: Inferred
Entities
session, visitor, landing page, referer
Grain
One row per visitor cookie and session index in sessions.
Time
The start dimension group on session start.
Key fields
sessions.referer_mediumsessions.referer_url_hostsessions.campaign_sourcesessions.landing_page_pathsessions.bouncesessions.events_during_session

What can change the answer 3

Caution: The session building blocks are missing

Trust: Source-defined

Sessions are assembled from four derived tables that are not in the repo, so landing page and referer logic cannot be checked.

Read the guide: Missing tables and stale references

Source: user_sessions.view.lookml L69-89
dating_platform/user_sessions.view.lookmlL69-89
        t.dvce_ismobile,        t.dvce_screenwidth,        t.dvce_screenheight      FROM ${sessions_basic.SQL_TABLE_NAME} AS s      LEFT JOIN ${sessions_geo.SQL_TABLE_NAME} AS g        ON s.app_id = g.app_id AND        s.domain_userid = g.domain_userid AND        s.domain_sessionidx = g.domain_sessionidx      LEFT JOIN ${TABLE}.sessions_landing_page AS l        ON s.app_id = l.app_id AND        s.domain_userid = l.domain_userid AND        s.domain_sessionidx = l.domain_sessionidx      LEFT JOIN ${sessions_last_page.SQL_TABLE_NAME} AS l2        ON s.app_id = l2.app_id AND        s.domain_userid = l2.domain_userid AND        s.domain_sessionidx = l2.domain_sessionidx      LEFT JOIN ${TABLE}.sessions_source AS s2        ON s.app_id = s2.app_id AND        s.domain_userid = s2.domain_userid AND        s.domain_sessionidx = s2.domain_sessionidx      LEFT JOIN ${sessions_technology.SQL_TABLE_NAME} AS t        ON s.app_id = t.app_id AND        s.domain_userid = t.domain_userid AND        s.domain_sessionidx = t.domain_sessionidx    sql_trigger_value: SELECT COUNT(*) FROM ${TABLE}.events_atomic    distkey: domain_userid    sortkeys:

dating-platform, user_sessions.view.lookml, lines 69-89

Caution: Direct is a catch-all

Trust: Source-defined

The else branch labels every unmatched medium as direct, including NULL and any new medium the tracker adds.

What goes wrong: Direct traffic grows whenever tracking breaks, which reads as brand strength.

Show the SQL: referer medium
Redshift SQLTrust: Translated
CASE  WHEN sessions.refr_medium = 'email' THEN 'email'  WHEN sessions.refr_medium = 'search' THEN 'search'  WHEN sessions.refr_medium = 'social' THEN 'social'  WHEN sessions.refr_medium = 'unknown' THEN 'other_website'  ELSE 'direct'END

Translated to Redshift SQL from user_sessions.view.lookml L218-224. Not run against a warehouse.

Show the original LookML: user_sessions.view.lookml L218-224
dating_platform/user_sessions.view.lookmlL218-224
    sql: ${TABLE}.exit_page_path  - dimension: exit_page    sql: ${TABLE}.exit_page_host || ${TABLE}.exit_page_path  - dimension: referer_medium    sql_case:      email: ${TABLE}.refr_medium = 'email'      search: ${TABLE}.refr_medium = 'search'      social: ${TABLE}.refr_medium = 'social'      other_website: ${TABLE}.refr_medium = 'unknown'      else: direct  - dimension: referer_source    sql: ${TABLE}.refr_source  - dimension: referer_term

dating-platform, user_sessions.view.lookml, lines 218-224

Note: Bounce means one event

Trust: Inferred

A one-page visit with page pings is not a bounce, while a page view with no other event is. Bounce depends on which events the tracker sends.

Show the SQL: bounce
Redshift SQLTrust: Translated
CASE WHEN sessions.number_of_events = 1 THEN 'yes' ELSE 'no' END

Translated to Redshift SQL from user_sessions.view.lookml L163-165. Not run against a warehouse.

Show the original LookML: user_sessions.view.lookml L163-165
dating_platform/user_sessions.view.lookmlL163-165
    - 1000    - 10000    sql: ${TABLE}.number_of_events  - dimension: bounce    type: yesno    sql: ${TABLE}.number_of_events = 1  - dimension: new_vs_returning_visitor    sql_case:      new: ${TABLE}.domain_sessionidx = 1

dating-platform, user_sessions.view.lookml, lines 163-165

How the real implementation does it

sessions

Trust: Source-defined

Maps the raw referer medium to a short channel list with a CASE. Every unmatched value, NULL included, becomes direct.

Show the SQL: channel mapping
Redshift SQLTrust: Translated
CASE  WHEN sessions.refr_medium = 'email' THEN 'email'  WHEN sessions.refr_medium = 'search' THEN 'search'  WHEN sessions.refr_medium = 'social' THEN 'social'  WHEN sessions.refr_medium = 'unknown' THEN 'other_website'  ELSE 'direct'END

Translated to Redshift SQL from user_sessions.view.lookml L218-224. Not run against a warehouse.

Show the original LookML: user_sessions.view.lookml L218-224
dating_platform/user_sessions.view.lookmlL218-224
    sql: ${TABLE}.exit_page_path  - dimension: exit_page    sql: ${TABLE}.exit_page_host || ${TABLE}.exit_page_path  - dimension: referer_medium    sql_case:      email: ${TABLE}.refr_medium = 'email'      search: ${TABLE}.refr_medium = 'search'      social: ${TABLE}.refr_medium = 'social'      other_website: ${TABLE}.refr_medium = 'unknown'      else: direct  - dimension: referer_source    sql: ${TABLE}.refr_source  - dimension: referer_term

dating-platform, user_sessions.view.lookml, lines 218-224

sessions

Trust: Source-defined

A session bounces when it has exactly one event. Bounce rate divides distinct bounced sessions by distinct sessions.

Show the SQL: bounce flag
Redshift SQLTrust: Translated
CASE WHEN sessions.number_of_events = 1 THEN 'yes' ELSE 'no' END

Translated to Redshift SQL from user_sessions.view.lookml L163-165. Not run against a warehouse.

Show the original LookML: user_sessions.view.lookml L163-165
dating_platform/user_sessions.view.lookmlL163-165
    - 1000    - 10000    sql: ${TABLE}.number_of_events  - dimension: bounce    type: yesno    sql: ${TABLE}.number_of_events = 1  - dimension: new_vs_returning_visitor    sql_case:      new: ${TABLE}.domain_sessionidx = 1

dating-platform, user_sessions.view.lookml, lines 163-165

traffic_pulse

Trust: Source-defined

Ranks the top 10 landing pages by sessions, with bounce rate and events per session side by side.

Show the SQL: engagement by landing page
Redshift SQLTrust: Translated
SELECT  sessions.landing_page_path AS landing_page_path,  COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx) AS count,  COUNT(DISTINCT CASE WHEN sessions.number_of_events = 1 THEN sessions.domain_userid || '-' || sessions.domain_sessionidx END)/NULLIF(COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx),0)::REAL AS bounce_rate,  SUM(sessions.number_of_events)/NULLIF(COUNT(DISTINCT sessions.domain_userid || '-' || sessions.domain_sessionidx),0)::REAL AS events_per_sessionFROM sessions  -- derived table, defined in the sourceGROUP BY 1ORDER BY count DESCLIMIT 10
  • On the dashboard this tile also follows its filters (date, referer_medium, new_vs_returning, country, landing_page, referer_host, app_id). They are left out here.

Translated to Redshift SQL from traffic_overview.dashboard.lookml L228-262, event_tracker.model.lookml L13-16 and user_sessions.view.lookml L105-106, L163-165, L207-209, L285-288, L294-303, L322-328. Not run against a warehouse.

Show the original LookML: traffic_overview.dashboard.lookml L228-250
dating_platform/traffic_overview.dashboard.lookmlL228-250
    y_axis_min: null    y_axis_max: null    hide_points: true  - name: sessions_and_engagement_levels_for_most_popular_landing_pages    title: Sessions count and events per session for top 10 landing pages    type: looker_column    explore: sessions    dimensions:    - sessions.landing_page_path    measures:    - sessions.count    - sessions.bounce_rate    - sessions.events_per_session    listen:      date: sessions.start_date      referer_medium: sessions.referer_medium      new_vs_returning: sessions.new_vs_returning_visitor      country: sessions.geography_country      landing_page: sessions.landing_page_path      referer_host: sessions.referer_url_host      app_id: sessions.app_id    sorts:    - sessions.count desc    limit: 10    width: 6    height: 4    legend_align: null    hide_legend: null    stacking: null

dating-platform, traffic_overview.dashboard.lookml, lines 228-250

visitors

Trust: Source-defined

Keeps first-session source and landing page per visitor, for first-touch attribution.

Source: guests.view.lookml L23-30
dating_platform/guests.view.lookmlL23-30
        s.refr_term,        s.refr_urlhost,        s.refr_urlpath      FROM        ${TABLE}.visitors_basic AS v        LEFT JOIN ${TABLE}.sessions_landing_page AS l        ON v.domain_userid = l.domain_userid        AND l.domain_sessionidx = 1        LEFT JOIN ${TABLE}.sessions_source AS s        ON v.domain_userid = s.domain_userid        AND s.domain_sessionidx = 1    sql_trigger_value: SELECT MAX(collector_tstamp) FROM ${TABLE}.events_atomic    distkey: domain_userid    sortkeys:

dating-platform, guests.view.lookml, lines 23-30

Other ways to measure it

Attribute by first touch

Trust: Suggested

Use visitors instead of sessions when the question is which channel acquired the visitor, not which channel brought this visit.

Show the SQL: visitors by first-touch channel
Redshift SQLTrust: Suggested
SELECT  CASE    WHEN visitors.refr_medium = 'email' THEN 'email'    WHEN visitors.refr_medium = 'search' THEN 'search'    WHEN visitors.refr_medium = 'social' THEN 'social'    WHEN visitors.refr_medium = 'unknown' THEN 'other_website'    ELSE 'direct'  END AS referer_medium,  COUNT(DISTINCT visitors.domain_userid) AS count,  COUNT(DISTINCT CASE WHEN visitors.number_of_events = 1 THEN visitors.domain_userid END)/NULLIF(COUNT(DISTINCT visitors.domain_userid),0)::REAL AS bounce_rate,  SUM(visitors.number_of_sessions)/NULLIF(COUNT(DISTINCT visitors.domain_userid),0)::REAL AS sessions_per_visitorFROM visitors  -- derived table, defined in the sourceGROUP BY 1ORDER BY count DESC

Suggested query. Fields translated to Redshift SQL from event_tracker.model.lookml L17 and guests.view.lookml L39-40, L75-77, L118-124, L141-154, L162-169. Not run against a warehouse.

Count engaged sessions explicitly

Trust: Suggested

Write the quality rule down once, so every report counts engaged sessions the same way.

Show the suggested SQL: engaged sessions by channel
Suggested, not from source
WITH s AS (  SELECT    domain_userid || '-' || domain_sessionidx AS session_id,    number_of_events,    CASE refr_medium      WHEN 'email' THEN 'email'      WHEN 'search' THEN 'search'      WHEN 'social' THEN 'social'      WHEN 'unknown' THEN 'other_website'      ELSE 'direct'    END AS channel  FROM sessions  -- the derived table defined in the source)SELECT  channel,  COUNT(DISTINCT session_id) AS sessions,  COUNT(DISTINCT CASE WHEN number_of_events >= 5 THEN session_id END) AS engaged_sessionsFROM sGROUP BY channel