dating_platform/user_sessions.view.lookml 63 dims25 measures 4 warnings Repo files

LookML view · dating-platform

How this LookML sessions view models acquisition, engagement and new vs returning traffic

At a glance

Does
One derived table that stitches session basics, geo, landing page, exit page, source and technology into a wide session row. It defines sessions.count, bounce_rate, new and returning session counts, events per session, and distinct counts of geos, campaigns, referers and devices.Trust: Source-defined
Why
The backbone of web acquisition reporting: where sessions come from, whether they bounce and whether visitors return. Every tile on the traffic dashboard reads it.Trust: Inferred
Grain
One row per session, keyed by session_id built as domain_userid || '-' || domain_sessionidx. No primary key is declared.Trust: Inferred
Source
dating_platform/user_sessions.view.lookml 469 lines
Source: user_sessions.view.lookml L1-10
dating_platform/user_sessions.view.lookmlL1-10
- view: session_apps  derived_table:    sql: |      SELECT  DISTINCT s.app_id      FROM    ${sessions.SQL_TABLE_NAME}    persist_for: 1 days    distkey: app_id    sortkeys:    - app_id  fields:  - dimension: app_id    sql: ${TABLE}.app_id- view: sessions

dating-platform, user_sessions.view.lookml, lines 1-10

Shape

Trust: Source-defined

Every field as declared, with the dashboard tiles that read it. Computed from the source; nothing here is edited.

session_apps user_sessions.view.lookml

Derived table: persists for 1 days. Builds on sessions

Dimensions 1

NameTypeSQLUsed byTags
app_idL11string${TABLE}.app_id-

sessions user_sessions.view.lookml

Derived table: rebuilt on a SQL trigger. Builds on sessions_basic (not in repo) sessions_geo (not in repo) sessions_last_page (not in repo) sessions_technology (not in repo)

Dimensions 62

NameTypeSQLUsed byTags
app_idL97string${TABLE}.app_idNew vs returning sessions countSessions count by referer mediumSessions count by countrySessions count by landing pageSessions count by countryNew vs returning visitorsSessions by day by referer mediumSessions count and events per session for top 10 landing pagesCohort analysisSession count and events per sesion for top 10 referer hostsSplit in number of sessions by number of previous visitsSplit in number of sessions by number of events per session
user_idL100string${TABLE}.domain_userid-
session_indexL102int${TABLE}.domain_sessionidx-
session_idL105string${TABLE}.domain_userid || '-' || ${TABLE}.domain_sessionidx-derived
session_index_tierL107tier${session_index}Split in number of sessions by number of previous visitsderived
startL120string${TABLE}.session_start_tsNew vs returning sessions countSessions count by referer mediumSessions count by countrySessions count by landing pageSessions count by countryNew vs returning visitorsSessions by day by referer mediumSessions count and events per session for top 10 landing pagesCohort analysisSession count and events per sesion for top 10 referer hostsSplit in number of sessions by number of previous visitsSplit in number of sessions by number of events per sessionname reused
starttime, date, week, monthL122time group${TABLE}.session_start_ts-name reused
endL130string${TABLE}.session_end_ts-
session_duration_secondsL132int
EXTRACT(EPOCH FROM (${TABLE}.session_end_ts - ${TABLE...EXTRACT(EPOCH FROM (${TABLE}.session_end_ts - ${TABLE}.session_start_ts))
-derived
session_duration_seconds_tieredL135tier${session_duration_seconds}-derived
events_during_sessionL147int${TABLE}.number_of_events-
events_during_session_tieredL150tier${TABLE}.number_of_eventsSplit in number of sessions by number of events per session
bounceL163yesno${TABLE}.number_of_events = 1-derived
new_vs_returning_visitorL166string
new: ${TABLE}.domain_sessionidx = 1; returning: ${TAB...new: ${TABLE}.domain_sessionidx = 1; returning: ${TABLE}.domain_sessionidx > 1; else: unknown
New vs returning sessions countSessions count by referer mediumSessions count by countrySessions count by landing pageSessions count by countryNew vs returning visitorsSessions by day by referer mediumSessions count and events per session for top 10 landing pagesCohort analysisSession count and events per sesion for top 10 referer hostsSplit in number of sessions by number of previous visitsSplit in number of sessions by number of events per session
distinct_pages_viewedL171string${TABLE}.distinct_pages_viewed-
distinct_pages_viewed_tieredL173tier${TABLE}.distinct_pages_viewed-
event_streamL186string${session_id}-derived
geography_countryL188string${TABLE}.geo_countryNew vs returning sessions countSessions count by referer mediumSessions count by countrySessions count by landing pageSessions count by countryNew vs returning visitorsSessions by day by referer mediumSessions count and events per session for top 10 landing pagesCohort analysisSession count and events per sesion for top 10 referer hostsSplit in number of sessions by number of previous visitsSplit in number of sessions by number of events per session
geography_country_three_letter_iso_codeL190string${TABLE}.geo_country_code_3_charactersSessions count by country
geography_country_two_letter_iso_codeL192string${TABLE}.geo_country_code_2_characters-
geography_regionL194string${TABLE}.geo_region-
geography_cityL196string${TABLE}.geo_city-
geography_zipcodeL198string${TABLE}.geo_zipcode-
geography_latitudeL200string${TABLE}.geo_latitude-
geography_longitudeL202string${TABLE}.geo_longitude-
landing_page_hostL204stringBTRIM(${TABLE}.landing_page_host)-derived
landing_page_pathL207string${TABLE}.landing_page_pathNew vs returning sessions countSessions count by referer mediumSessions count by countrySessions count by landing pageSessions count by countryNew vs returning visitorsSessions by day by referer mediumSessions count and events per session for top 10 landing pagesCohort analysisSession count and events per sesion for top 10 referer hostsSplit in number of sessions by number of previous visitsSplit in number of sessions by number of events per session
landing_pageL210string${TABLE}.landing_page_host || ${TABLE}.landing_page_path-derived
exit_page_hostL212string${TABLE}.exit_page_host-
exit_page_pathL214string${TABLE}.exit_page_path-
exit_pageL216string${TABLE}.exit_page_host || ${TABLE}.exit_page_path-derived
referer_mediumL218string
email: ${TABLE}.refr_medium = 'email'; search: ${TABL...email: ${TABLE}.refr_medium = 'email'; search: ${TABLE}.refr_medium = 'search'; social: ${TABLE}.refr_medium = 'social'; other_website: ${TABLE}.refr_medium = 'unknown'; else: direct
New vs returning sessions countSessions count by referer mediumSessions count by countrySessions count by landing pageSessions count by countryNew vs returning visitorsSessions by day by referer mediumSessions count and events per session for top 10 landing pagesCohort analysisSession count and events per sesion for top 10 referer hostsSplit in number of sessions by number of previous visitsSplit in number of sessions by number of events per session
referer_sourceL225string${TABLE}.refr_source-
referer_termL227string${TABLE}.refr_term-
referer_url_hostL229string${TABLE}.refr_urlhostNew vs returning sessions countSessions count by referer mediumSessions count by countrySessions count by landing pageSessions count by countryNew vs returning visitorsSessions by day by referer mediumSessions count and events per session for top 10 landing pagesCohort analysisSession count and events per sesion for top 10 referer hostsSplit in number of sessions by number of previous visitsSplit in number of sessions by number of events per session
referer_url_pathL231string${TABLE}.refr_urlpath-
campaign_mediumL233string${TABLE}.mkt_medium-
campaign_sourceL235string${TABLE}.mkt_source-
campaign_termL237string${TABLE}.mkt_term-
campaign_nameL239string${TABLE}.mkt_campaign-
device_typeL241string${TABLE}.dvce_type-
device_is_mobileL243string${TABLE}.dvce_ismobile-
device_screen_widthL245string${TABLE}.dvce_screenwidth-
device_screen_heightL247string${TABLE}.dvce_screenheight-
operating_systemL249string${TABLE}.os_name-
operating_system_familyL251string${TABLE}.os_family-
operating_system_manufacturerL253string${TABLE}.os_manufacturer-
browserL255string${TABLE}.br_name-
browser_versionL257string${TABLE}.br_version-
browser_typeL259string${TABLE}.br_type-
browser_renderengineL261string${TABLE}.br_renderengine-
browser_languageL263string${TABLE}.br_lang-
browser_has_director_pluginL265string${TABLE}.br_features_director-
browser_has_flash_pluginL267string${TABLE}.br_features_flash-
browser_has_gears_pluginL269string${TABLE}.br_features_gears-
browser_has_java_pluginL271string${TABLE}.br_features_java-
browser_has_pdf_pluginL273string${TABLE}.br_features_pdf-
browser_has_quicktime_pluginL275string${TABLE}.br_features_quicktime-
browser_has_realplayer_pluginL277string${TABLE}.br_features_realplayer-
browser_has_silverlight_pluginL279string${TABLE}.br_features_silverlight-
browser_has_windowsmedia_pluginL281string${TABLE}.br_features_windowsmedia-
browser_supports_cookiesL283string${TABLE}.br_cookies-

Measures 25

NameTypeSQLUsed byTags
countL285count_distinct${session_id}New vs returning sessions countSessions count by referer mediumSessions count by countrySessions count by landing pageSessions count by countryNew vs returning visitorsSessions by day by referer mediumSessions count and events per session for top 10 landing pagesSession count and events per sesion for top 10 referer hostsSplit in number of sessions by number of previous visitsSplit in number of sessions by number of events per sessionderived
visitors_countL289count_distinct${user_id}-hiddenderived
bounced_sessions_countL294count_distinct${session_id}filters: bounce = true-derivedfiltered
bounce_rateL300number${bounced_sessions_count}/NULLIF(${count},0)::REALSessions count and events per session for top 10 landing pagesSession count and events per sesion for top 10 referer hostsderived
sessions_from_new_visitors_countL304count_distinct${session_id}filters: session_index = 1-derivedfiltered
sessions_from_returning_visitor_countL310number${count} - ${sessions_from_new_visitors_count}-derived
new_visitors_count_over_total_visitors_countL314number${sessions_from_new_visitors_count}/NULLIF(${count},0)::REAL-derived
returning_visitors_count_over_total_visitors_countL318number
${sessions_from_returning_visitor_count}/NULLIF(${cou...${sessions_from_returning_visitor_count}/NULLIF(${count},0)::REAL
-derived
events_countL322sum${TABLE}.number_of_events-
events_per_sessionL325number${events_count}/NULLIF(${count},0)::REALSessions count by countrySessions count and events per session for top 10 landing pagesSession count and events per sesion for top 10 referer hostsderived
events_per_visitorL329number${events_count}/NULLIF(${visitors_count},0)::REAL-derived
country_countL333count_distinct${geography_country}-derived
region_countL339count_distinct${geography_region}-derived
city_countL346count_distinct${geography_city}-derived
zip_code_countL354count_distinct${geography_zipcode}-derived
campaign_medium_countL363count_distinct${campaign_medium}-derived
campaign_source_countL369count_distinct${campaign_source}-derived
campaign_term_countL376count_distinct${campaign_term}-derived
campaign_countL384count_distinct${campaign_name}-derived
referer_medium_countL393count_distinct${referer_medium}-derived
referer_source_countL399count_distinct${referer_source}-derived
referer_term_countL406count_distinct${referer_term}-derived
device_countL414count_distinct${device_type}-derived
operating_system_countL418count_distinct${operating_system}-derived
browser_countL424count_distinct${browser}-derived

Relationships

Trust: Source-defined
Relationships of session_apps, sessions
Relationships of session_apps, sessions. Text version follows the diagram.Builds onThese viewsUsed by: explores, views, dashboardsbase viewbase viewas sessions, on events.domain_userid = sessions...12 tiles sessions derived table session_apps explore in event_tracker sessions explore in event_tracker events explore in event_tracker traffic_pulse dashboard
  • This Block
  • No relationship declared
  • Not in the repo
Text version
  • sessions feeds session_apps
  • session_apps is the base view of session_apps: base view
  • sessions_basic (not in repo) feeds sessions (no relationship declared)
  • sessions_geo (not in repo) feeds sessions (no relationship declared)
  • sessions_last_page (not in repo) feeds sessions (no relationship declared)
  • sessions_technology (not in repo) feeds sessions (no relationship declared)
  • sessions is the base view of sessions: base view
  • sessions is joined into events: as sessions, on events.domain_userid = sessions... (no relationship declared)
  • sessions is read by traffic_pulse: 12 tiles

Worth noticing

New vs returning comes from the cookie session index

Trust: Source-defined

new_vs_returning_visitor is new when domain_sessionidx = 1 and returning when it is above 1. The index is per cookie, so a cleared cookie or a second device counts as new.

Source: user_sessions.view.lookml L166-170
dating_platform/user_sessions.view.lookmlL166-170
  - dimension: bounce    type: yesno    sql: ${TABLE}.number_of_events = 1  - dimension: new_vs_returning_visitor    sql_case:      new: ${TABLE}.domain_sessionidx = 1      returning: ${TABLE}.domain_sessionidx > 1      else: unknown  - dimension: distinct_pages_viewed    sql: ${TABLE}.distinct_pages_viewed  - dimension: distinct_pages_viewed_tiered

dating-platform, user_sessions.view.lookml, lines 166-170

Returning sessions are a subtraction

Trust: Source-defined

sessions_from_returning_visitor_count is sessions.count minus sessions_from_new_visitors_count. Sessions with a NULL index land in returning rather than unknown.

Source: user_sessions.view.lookml L304-313
dating_platform/user_sessions.view.lookmlL304-313
    type: number    decimals: 2    sql: ${bounced_sessions_count}/NULLIF(${count},0)::REAL  - measure: sessions_from_new_visitors_count    type: count_distinct    sql: ${session_id}    filters:      session_index: 1    detail: individual_detail*  - measure: sessions_from_returning_visitor_count    type: number    sql: ${count} - ${sessions_from_new_visitors_count}    detail: individual_detail*  - measure: new_visitors_count_over_total_visitors_count    type: number    decimals: 2

dating-platform, user_sessions.view.lookml, lines 304-313

Unknown referers become other_website, NULL becomes direct

Trust: Source-defined

referer_medium maps refr_medium = 'unknown' to other_website and sends every other value, including NULL and internal, to the else branch direct.

Source: 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

What can change the answer 4

Caution: Four upstream session tables are not in the repo

Trust: Missing

The derived table reads ${sessions_basic.SQL_TABLE_NAME}, sessions_geo, sessions_last_page and sessions_technology. None of these views is defined here, so the session logic itself cannot be reviewed.

What goes wrong: Bounce, duration and landing page all depend on rules you cannot see or test from this repo.

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: session_apps selects from an alias that does not exist

Trust: Source-defined

session_apps.app_id is built with SELECT DISTINCT s.app_id FROM ${sessions.SQL_TABLE_NAME}, but the FROM clause gives no alias s.

What goes wrong: The persisted table fails to build, so the session_apps explore returns an error rather than a list of apps.

Read the guide: Missing tables and stale references

Source: user_sessions.view.lookml L3-9
dating_platform/user_sessions.view.lookmlL3-9
- view: session_apps  derived_table:    sql: |      SELECT  DISTINCT s.app_id      FROM    ${sessions.SQL_TABLE_NAME}    persist_for: 1 days    distkey: app_id    sortkeys:    - app_id  fields:  - dimension: app_id    sql: ${TABLE}.app_id

dating-platform, user_sessions.view.lookml, lines 3-9

Caution: No primary key on a view that is joined

Trust: Source-defined

The events explore joins sessions on two keys, yet sessions declares no primary_key. Looker cannot apply symmetric aggregates to its sums.

What goes wrong: events_count summed through the events explore repeats each session total once per event.

Read the guide: Primary keys and counts

Source: user_sessions.view.lookml L105-106
dating_platform/user_sessions.view.lookmlL105-106
  - dimension: session_index    type: int    sql: ${TABLE}.domain_sessionidx  - dimension: session_id    sql: ${TABLE}.domain_userid || '-' || ${TABLE}.domain_sessionidx  - dimension: session_index_tier    type: tier    tiers:

dating-platform, user_sessions.view.lookml, lines 105-106

Note: start is both a dimension and a dimension group

Trust: Source-defined

dimension: start and dimension_group: start share a name, and the detail set lists zipe_code_count and sessions_from_returning_visitors_count, which are not declared.

Source: user_sessions.view.lookml L120-129
dating_platform/user_sessions.view.lookmlL120-129
    - 100    - 1000    sql: ${session_index}  - dimension: start    sql: ${TABLE}.session_start_ts  - dimension_group: start    type: time    timeframes:    - time    - date    - week    - month    sql: ${TABLE}.session_start_ts  - dimension: end    sql: ${TABLE}.session_end_ts  - dimension: session_duration_seconds

dating-platform, user_sessions.view.lookml, lines 120-129

Parser checks 9

Trust: Source-defined

Mechanical findings from parsing the LookML. They are facts about the files. The cards above explain which ones matter.

Show all 9 checks
  • no-primary-key 2
    • user_sessions.view.lookml:1 session_apps declares no primary_key.
    • user_sessions.view.lookml:13 sessions declares no primary_key.
  • missing-view 4
    • user_sessions.view.lookml:15 sessions builds on ${sessions_basic.SQL_TABLE_NAME}; no view named sessions_basic is in the repo.
    • user_sessions.view.lookml:15 sessions builds on ${sessions_geo.SQL_TABLE_NAME}; no view named sessions_geo is in the repo.
    • user_sessions.view.lookml:15 sessions builds on ${sessions_last_page.SQL_TABLE_NAME}; no view named sessions_last_page is in the repo.
    • user_sessions.view.lookml:15 sessions builds on ${sessions_technology.SQL_TABLE_NAME}; no view named sessions_technology is in the repo.
  • name-collision 1
    • user_sessions.view.lookml:122 sessions.start is declared as both dimension and dimension_group.
  • set-member-missing 2
    • user_sessions.view.lookml:431 Set sessions.detail lists "sessions_from_returning_visitors_count", which is not a field or set in this view.
    • user_sessions.view.lookml:431 Set sessions.detail lists "zipe_code_count", which is not a field or set in this view.

Related

Guides built on this file

Related source files

Source model