From 32de2ec25e7bd05a6d3dff0188c73c6324db5a8d Mon Sep 17 00:00:00 2001 From: Robbie Date: Wed, 1 May 2024 20:41:24 +0100 Subject: [PATCH] feat(web-analytics): Use $entry in session prop names (#22019) Use $entry in session prop names --- frontend/src/lib/taxonomy.test.tsx | 6 +- frontend/src/lib/taxonomy.tsx | 8 +- .../scenes/web-analytics/WebAnalyticsTile.tsx | 12 +-- .../test/__snapshots__/test_annotation.ambr | 8 +- posthog/api/test/test_session.py | 38 ++++---- posthog/hogql/database/schema/sessions.py | 96 +++++++++---------- .../database/schema/test/test_sessions.py | 2 +- .../test/__snapshots__/test_database.ambr | 80 ++++++++-------- .../web_analytics/stats_table.py | 12 +-- 9 files changed, 130 insertions(+), 132 deletions(-) diff --git a/frontend/src/lib/taxonomy.test.tsx b/frontend/src/lib/taxonomy.test.tsx index 20475a1f15128..0975471012e03 100644 --- a/frontend/src/lib/taxonomy.test.tsx +++ b/frontend/src/lib/taxonomy.test.tsx @@ -29,12 +29,12 @@ describe('taxonomy', () => { const sessionPropertyNames = Object.keys(CORE_FILTER_DEFINITIONS_BY_GROUP.session_properties) it('should have a $session_referring_domain property', () => { const property: CoreFilterDefinition = - CORE_FILTER_DEFINITIONS_BY_GROUP.session_properties['$session_referring_domain'] - expect(property.label).toEqual('Session Referring Domain') + CORE_FILTER_DEFINITIONS_BY_GROUP.session_properties['$entry_referring_domain'] + expect(property.label).toEqual('Entry Referring Domain') }) it(`should have every property in SESSION_PROPERTIES_ADAPTED_FROM_PERSON`, () => { for (const property of Array.from(SESSION_INITIAL_PROPERTIES_ADAPTED_FROM_EVENTS.keys())) { - expect(sessionPropertyNames).toContain('$session_' + property.replace('$', '')) + expect(sessionPropertyNames).toContain('$entry_' + property.replace('$', '')) } }) }) diff --git a/frontend/src/lib/taxonomy.tsx b/frontend/src/lib/taxonomy.tsx index 71385d832d84d..130286acabafe 100644 --- a/frontend/src/lib/taxonomy.tsx +++ b/frontend/src/lib/taxonomy.tsx @@ -1016,7 +1016,7 @@ export const CORE_FILTER_DEFINITIONS_BY_GROUP = { description: The timestamp of the last event from this session, examples: [new Date().toISOString()], }, - $entry_url: { + entry_current_url: { label: 'Entry URL', description: The first URL visited in this session, examples: ['https://example.com/interesting-article?parameter=true'], @@ -1026,7 +1026,7 @@ export const CORE_FILTER_DEFINITIONS_BY_GROUP = { description: The first pathname visited in this session, examples: ['https://example.com/interesting-article?parameter=true'], }, - $exit_url: { + $exit_current_url: { label: 'Exit URL', description: The last URL visited in this session, examples: ['https://example.com/interesting-article?parameter=true'], @@ -1094,9 +1094,9 @@ for (const [key, value] of Object.entries(CORE_FILTER_DEFINITIONS_BY_GROUP.event CORE_FILTER_DEFINITIONS_BY_GROUP.person_properties[key] = value } if (SESSION_INITIAL_PROPERTIES_ADAPTED_FROM_EVENTS.has(key)) { - CORE_FILTER_DEFINITIONS_BY_GROUP.session_properties[`$session_${key.replace(/^\$/, '')}`] = { + CORE_FILTER_DEFINITIONS_BY_GROUP.session_properties[`$entry_${key.replace(/^\$/, '')}`] = { ...value, - label: `Session ${value.label}`, + label: `Entry ${value.label}`, description: 'description' in value ? `${value.description} Data from the first event in this session.` diff --git a/frontend/src/scenes/web-analytics/WebAnalyticsTile.tsx b/frontend/src/scenes/web-analytics/WebAnalyticsTile.tsx index e2cef96b0a292..62e3cce87f7fb 100644 --- a/frontend/src/scenes/web-analytics/WebAnalyticsTile.tsx +++ b/frontend/src/scenes/web-analytics/WebAnalyticsTile.tsx @@ -173,17 +173,17 @@ export const webStatsBreakdownToPropertyName = ( case WebStatsBreakdown.InitialChannelType: return { key: '$channel_type', type: PropertyFilterType.Session } case WebStatsBreakdown.InitialReferringDomain: - return { key: '$session_referring_domain', type: PropertyFilterType.Session } + return { key: '$entry_referring_domain', type: PropertyFilterType.Session } case WebStatsBreakdown.InitialUTMSource: - return { key: '$session_utm_source', type: PropertyFilterType.Session } + return { key: '$entry_utm_source', type: PropertyFilterType.Session } case WebStatsBreakdown.InitialUTMCampaign: - return { key: '$session_utm_campaign', type: PropertyFilterType.Session } + return { key: '$entry_utm_campaign', type: PropertyFilterType.Session } case WebStatsBreakdown.InitialUTMMedium: - return { key: '$session_utm_medium', type: PropertyFilterType.Session } + return { key: '$entry_utm_medium', type: PropertyFilterType.Session } case WebStatsBreakdown.InitialUTMContent: - return { key: '$session_utm_content', type: PropertyFilterType.Session } + return { key: '$entry_utm_content', type: PropertyFilterType.Session } case WebStatsBreakdown.InitialUTMTerm: - return { key: '$session_utm_term', type: PropertyFilterType.Session } + return { key: '$entry_utm_term', type: PropertyFilterType.Session } case WebStatsBreakdown.Browser: return { key: '$browser', type: PropertyFilterType.Event } case WebStatsBreakdown.OS: diff --git a/posthog/api/test/__snapshots__/test_annotation.ambr b/posthog/api/test/__snapshots__/test_annotation.ambr index 01a55f2133a4b..8742b3abcee01 100644 --- a/posthog/api/test/__snapshots__/test_annotation.ambr +++ b/posthog/api/test/__snapshots__/test_annotation.ambr @@ -361,10 +361,10 @@ FROM "posthog_annotation" LEFT OUTER JOIN "posthog_dashboarditem" ON ("posthog_annotation"."dashboard_item_id" = "posthog_dashboarditem"."id") LEFT OUTER JOIN "posthog_user" ON ("posthog_annotation"."created_by_id" = "posthog_user"."id") - WHERE ((("posthog_annotation"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid - AND "posthog_annotation"."scope" = 'organization') - OR "posthog_annotation"."team_id" = 2) - AND NOT "posthog_annotation"."deleted") + WHERE (NOT "posthog_annotation"."deleted" + AND (("posthog_annotation"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid + AND "posthog_annotation"."scope" = 'organization') + OR "posthog_annotation"."team_id" = 2)) ORDER BY "posthog_annotation"."date_marker" DESC LIMIT 1000 ''' diff --git a/posthog/api/test/test_session.py b/posthog/api/test/test_session.py index f2850957686ec..742a9a0fc2437 100644 --- a/posthog/api/test/test_session.py +++ b/posthog/api/test/test_session.py @@ -33,18 +33,18 @@ def test_expected_session_properties(self): "$autocapture_count", "$channel_type", "$end_timestamp", - "$entry_url", + "entry_current_url", "$entry_pathname", - "$exit_url", + "$exit_current_url", "$exit_pathname", - "$session_gad_source", - "$session_gclid", - "$session_referring_domain", - "$session_utm_campaign", - "$session_utm_content", - "$session_utm_medium", - "$session_utm_source", - "$session_utm_term", + "$entry_gad_source", + "$entry_gclid", + "$entry_referring_domain", + "$entry_utm_campaign", + "$entry_utm_content", + "$entry_utm_medium", + "$entry_utm_source", + "$entry_utm_term", "$pageview_count", "$session_duration", "$start_timestamp", @@ -57,11 +57,11 @@ def test_search_session_properties(self): self.assertEqual(response.status_code, status.HTTP_200_OK) actual_properties = {entry["name"] for entry in response.json()["results"]} expected_properties = { - "$session_utm_campaign", - "$session_utm_content", - "$session_utm_medium", - "$session_utm_source", - "$session_utm_term", + "$entry_utm_campaign", + "$entry_utm_content", + "$entry_utm_medium", + "$entry_utm_source", + "$entry_utm_term", } assert actual_properties == expected_properties @@ -107,7 +107,7 @@ def test_search_channel_type_values(self): assert actual_values == expected_values def test_list_session_property_values(self): - response = self.client.get(f"/api/projects/{self.team.pk}/sessions/values/?key=$session_utm_source") + response = self.client.get(f"/api/projects/{self.team.pk}/sessions/values/?key=$entry_utm_source") self.assertEqual(response.status_code, status.HTTP_200_OK) actual_values = {entry["name"] for entry in response.json()} expected_values = { @@ -117,7 +117,7 @@ def test_list_session_property_values(self): assert actual_values == expected_values def test_search_session_property_values(self): - response = self.client.get(f"/api/projects/{self.team.pk}/sessions/values/?key=$session_utm_source&value=tub") + response = self.client.get(f"/api/projects/{self.team.pk}/sessions/values/?key=$entry_utm_source&value=tub") self.assertEqual(response.status_code, status.HTTP_200_OK) actual_values = {entry["name"] for entry in response.json()} expected_values = { @@ -127,14 +127,14 @@ def test_search_session_property_values(self): def test_search_session_property_no_matching_values(self): response = self.client.get( - f"/api/projects/{self.team.pk}/sessions/values/?key=$session_utm_source&value=doesnotexist" + f"/api/projects/{self.team.pk}/sessions/values/?key=$entry_utm_source&value=doesnotexist" ) self.assertEqual(response.status_code, status.HTTP_200_OK) assert len(response.json()) == 0 def test_search_missing_session_property_values(self): response = self.client.get( - f"/api/projects/{self.team.pk}/sessions/values/?key=$session_utm_source&value=doesnotexist" + f"/api/projects/{self.team.pk}/sessions/values/?key=$entry_utm_source&value=doesnotexist" ) self.assertEqual(response.status_code, status.HTTP_200_OK) assert len(response.json()) == 0 diff --git a/posthog/hogql/database/schema/sessions.py b/posthog/hogql/database/schema/sessions.py index 0d5c664e71abe..e3ba63c23422a 100644 --- a/posthog/hogql/database/schema/sessions.py +++ b/posthog/hogql/database/schema/sessions.py @@ -61,18 +61,18 @@ "$start_timestamp": DateTimeDatabaseField(name="$start_timestamp"), "$end_timestamp": DateTimeDatabaseField(name="$end_timestamp"), "$urls": StringArrayDatabaseField(name="$urls"), - "$entry_url": StringDatabaseField(name="$entry_url"), + "entry_current_url": StringDatabaseField(name="entry_current_url"), "$entry_pathname": StringDatabaseField(name="$entry_pathname"), - "$exit_url": StringDatabaseField(name="$exit_url"), + "$exit_current_url": StringDatabaseField(name="$exit_current_url"), "$exit_pathname": StringDatabaseField(name="$exit_pathname"), - "$session_utm_source": StringDatabaseField(name="$session_utm_source"), - "$session_utm_campaign": StringDatabaseField(name="$session_utm_campaign"), - "$session_utm_medium": StringDatabaseField(name="$session_utm_medium"), - "$session_utm_term": StringDatabaseField(name="$session_utm_term"), - "$session_utm_content": StringDatabaseField(name="$session_utm_content"), - "$session_referring_domain": StringDatabaseField(name="$session_referring_domain"), - "$session_gclid": StringDatabaseField(name="$session_gclid"), - "$session_gad_source": StringDatabaseField(name="$session_gad_source"), + "$entry_utm_source": StringDatabaseField(name="$entry_utm_source"), + "$entry_utm_campaign": StringDatabaseField(name="$entry_utm_campaign"), + "$entry_utm_medium": StringDatabaseField(name="$entry_utm_medium"), + "$entry_utm_term": StringDatabaseField(name="$entry_utm_term"), + "$entry_utm_content": StringDatabaseField(name="$entry_utm_content"), + "$entry_referring_domain": StringDatabaseField(name="$entry_referring_domain"), + "$entry_gclid": StringDatabaseField(name="$entry_gclid"), + "$entry_gad_source": StringDatabaseField(name="$entry_gad_source"), "$event_count_map": DatabaseField(name="$event_count_map"), "$pageview_count": IntegerDatabaseField(name="$pageview_count"), "$autocapture_count": IntegerDatabaseField(name="$autocapture_count"), @@ -134,31 +134,29 @@ def select_from_sessions_table( ) ], ), - "$entry_url": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "entry_url"])]), + "entry_current_url": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "entry_url"])]), "$entry_pathname": ast.Call( name="path", args=[ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "entry_url"])])] ), - "$exit_url": ast.Call(name="argMaxMerge", args=[ast.Field(chain=[table_name, "exit_url"])]), + "$exit_current_url": ast.Call(name="argMaxMerge", args=[ast.Field(chain=[table_name, "exit_url"])]), "$exit_pathname": ast.Call( name="path", args=[ ast.Call(name="argMaxMerge", args=[ast.Field(chain=[table_name, "exit_url"])]), ], ), - "$session_utm_source": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_utm_source"])]), - "$session_utm_campaign": ast.Call( + "$entry_utm_source": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_utm_source"])]), + "$entry_utm_campaign": ast.Call( name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_utm_campaign"])] ), - "$session_utm_medium": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_utm_medium"])]), - "$session_utm_term": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_utm_term"])]), - "$session_utm_content": ast.Call( - name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_utm_content"])] - ), - "$session_referring_domain": ast.Call( + "$entry_utm_medium": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_utm_medium"])]), + "$entry_utm_term": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_utm_term"])]), + "$entry_utm_content": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_utm_content"])]), + "$entry_referring_domain": ast.Call( name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_referring_domain"])] ), - "$session_gclid": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_gclid"])]), - "$session_gad_source": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_gad_source"])]), + "$entry_gclid": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_gclid"])]), + "$entry_gad_source": ast.Call(name="argMinMerge", args=[ast.Field(chain=[table_name, "initial_gad_source"])]), "$event_count_map": ast.Call( name="sumMap", args=[ast.Field(chain=[table_name, "event_count_map"])], @@ -203,12 +201,12 @@ def select_from_sessions_table( ], ) aggregate_fields["$channel_type"] = create_channel_type_expr( - campaign=aggregate_fields["$session_utm_campaign"], - medium=aggregate_fields["$session_utm_medium"], - source=aggregate_fields["$session_utm_source"], - referring_domain=aggregate_fields["$session_referring_domain"], - gclid=aggregate_fields["$session_gclid"], - gad_source=aggregate_fields["$session_gad_source"], + campaign=aggregate_fields["$entry_utm_campaign"], + medium=aggregate_fields["$entry_utm_medium"], + source=aggregate_fields["$entry_utm_source"], + referring_domain=aggregate_fields["$entry_referring_domain"], + gclid=aggregate_fields["$entry_gclid"], + gad_source=aggregate_fields["$entry_gad_source"], ) select_fields: list[ast.Expr] = [] @@ -309,27 +307,27 @@ def get_property_type(field_name: str, field_definition: FieldOrTable): SESSION_PROPERTY_TO_RAW_SESSIONS_EXPR_MAP = { - "$session_referring_domain": "finalizeAggregation(initial_referring_domain)", - "$session_utm_source": "finalizeAggregation(initial_utm_source)", - "$session_utm_campaign": "finalizeAggregation(initial_utm_campaign)", - "$session_utm_medium": "finalizeAggregation(initial_utm_medium)", - "$session_utm_term": "finalizeAggregation(initial_utm_term)", - "$session_utm_content": "finalizeAggregation(initial_utm_content)", - "$session_gclid": "finalizeAggregation(initial_gclid)", - "$session_gad_source": "finalizeAggregation(initial_gad_source)", - "$session_gclsrc": "finalizeAggregation(initial_gclsrc)", - "$session_dclid": "finalizeAggregation(initial_dclid)", - "$session_gbraid": "finalizeAggregation(initial_gbraid)", - "$session_wbraid": "finalizeAggregation(initial_wbraid)", - "$session_fbclid": "finalizeAggregation(initial_fbclid)", - "$session_msclkid": "finalizeAggregation(initial_msclkid)", - "$session_twclid": "finalizeAggregation(initial_twclid)", - "$session_li_fat_id": "finalizeAggregation(initial_li_fat_id)", - "$session_mc_cid": "finalizeAggregation(initial_mc_cid)", - "$session_igshid": "finalizeAggregation(initial_igshid)", - "$session_ttclid": "finalizeAggregation(initial_ttclid)", - "$entry_url": "finalizeAggregation(entry_url)", - "$exit_url": "finalizeAggregation(exit_url)", + "$entry_referring_domain": "finalizeAggregation(initial_referring_domain)", + "$entry_utm_source": "finalizeAggregation(initial_utm_source)", + "$entry_utm_campaign": "finalizeAggregation(initial_utm_campaign)", + "$entry_utm_medium": "finalizeAggregation(initial_utm_medium)", + "$entry_utm_term": "finalizeAggregation(initial_utm_term)", + "$entry_utm_content": "finalizeAggregation(initial_utm_content)", + "$entry_gclid": "finalizeAggregation(initial_gclid)", + "$entry_gad_source": "finalizeAggregation(initial_gad_source)", + "$entry_gclsrc": "finalizeAggregation(initial_gclsrc)", + "$entry_dclid": "finalizeAggregation(initial_dclid)", + "$entry_gbraid": "finalizeAggregation(initial_gbraid)", + "$entry_wbraid": "finalizeAggregation(initial_wbraid)", + "$entry_fbclid": "finalizeAggregation(initial_fbclid)", + "$entry_msclkid": "finalizeAggregation(initial_msclkid)", + "$entry_twclid": "finalizeAggregation(initial_twclid)", + "$entry_li_fat_id": "finalizeAggregation(initial_li_fat_id)", + "$entry_mc_cid": "finalizeAggregation(initial_mc_cid)", + "$entry_igshid": "finalizeAggregation(initial_igshid)", + "$entry_ttclid": "finalizeAggregation(initial_ttclid)", + "entry_current_url": "finalizeAggregation(entry_url)", + "$exit_current_url": "finalizeAggregation(exit_url)", } diff --git a/posthog/hogql/database/schema/test/test_sessions.py b/posthog/hogql/database/schema/test/test_sessions.py index 09dc80ee1717a..02b70bf9e45de 100644 --- a/posthog/hogql/database/schema/test/test_sessions.py +++ b/posthog/hogql/database/schema/test/test_sessions.py @@ -127,7 +127,7 @@ def test_persons_and_sessions_on_events(self): response = execute_hogql_query( parse_select( - "select events.person_id, session.$session_utm_source from events where $session_id = {session_id} or $session_id = {session_id2} order by 2 asc", + "select events.person_id, session.$entry_utm_source from events where $session_id = {session_id} or $session_id = {session_id2} order by 2 asc", placeholders={"session_id": ast.Constant(value=s1), "session_id2": ast.Constant(value=s2)}, ), self.team, diff --git a/posthog/hogql/database/test/__snapshots__/test_database.ambr b/posthog/hogql/database/test/__snapshots__/test_database.ambr index 94de6aac07176..a4a69c7886be4 100644 --- a/posthog/hogql/database/test/__snapshots__/test_database.ambr +++ b/posthog/hogql/database/test/__snapshots__/test_database.ambr @@ -223,18 +223,18 @@ "$start_timestamp", "$end_timestamp", "$urls", - "$entry_url", + "entry_current_url", "$entry_pathname", - "$exit_url", + "$exit_current_url", "$exit_pathname", - "$session_utm_source", - "$session_utm_campaign", - "$session_utm_medium", - "$session_utm_term", - "$session_utm_content", - "$session_referring_domain", - "$session_gclid", - "$session_gad_source", + "$entry_utm_source", + "$entry_utm_campaign", + "$entry_utm_medium", + "$entry_utm_term", + "$entry_utm_content", + "$entry_referring_domain", + "$entry_gclid", + "$entry_gad_source", "$event_count_map", "$pageview_count", "$autocapture_count", @@ -632,7 +632,7 @@ "type": "array" }, { - "key": "$entry_url", + "key": "entry_current_url", "type": "string" }, { @@ -640,7 +640,7 @@ "type": "string" }, { - "key": "$exit_url", + "key": "$exit_current_url", "type": "string" }, { @@ -648,35 +648,35 @@ "type": "string" }, { - "key": "$session_utm_source", + "key": "$entry_utm_source", "type": "string" }, { - "key": "$session_utm_campaign", + "key": "$entry_utm_campaign", "type": "string" }, { - "key": "$session_utm_medium", + "key": "$entry_utm_medium", "type": "string" }, { - "key": "$session_utm_term", + "key": "$entry_utm_term", "type": "string" }, { - "key": "$session_utm_content", + "key": "$entry_utm_content", "type": "string" }, { - "key": "$session_referring_domain", + "key": "$entry_referring_domain", "type": "string" }, { - "key": "$session_gclid", + "key": "$entry_gclid", "type": "string" }, { - "key": "$session_gad_source", + "key": "$entry_gad_source", "type": "string" }, { @@ -1294,18 +1294,18 @@ "$start_timestamp", "$end_timestamp", "$urls", - "$entry_url", + "entry_current_url", "$entry_pathname", - "$exit_url", + "$exit_current_url", "$exit_pathname", - "$session_utm_source", - "$session_utm_campaign", - "$session_utm_medium", - "$session_utm_term", - "$session_utm_content", - "$session_referring_domain", - "$session_gclid", - "$session_gad_source", + "$entry_utm_source", + "$entry_utm_campaign", + "$entry_utm_medium", + "$entry_utm_term", + "$entry_utm_content", + "$entry_referring_domain", + "$entry_gclid", + "$entry_gad_source", "$event_count_map", "$pageview_count", "$autocapture_count", @@ -1703,7 +1703,7 @@ "type": "array" }, { - "key": "$entry_url", + "key": "entry_current_url", "type": "string" }, { @@ -1711,7 +1711,7 @@ "type": "string" }, { - "key": "$exit_url", + "key": "$exit_current_url", "type": "string" }, { @@ -1719,35 +1719,35 @@ "type": "string" }, { - "key": "$session_utm_source", + "key": "$entry_utm_source", "type": "string" }, { - "key": "$session_utm_campaign", + "key": "$entry_utm_campaign", "type": "string" }, { - "key": "$session_utm_medium", + "key": "$entry_utm_medium", "type": "string" }, { - "key": "$session_utm_term", + "key": "$entry_utm_term", "type": "string" }, { - "key": "$session_utm_content", + "key": "$entry_utm_content", "type": "string" }, { - "key": "$session_referring_domain", + "key": "$entry_referring_domain", "type": "string" }, { - "key": "$session_gclid", + "key": "$entry_gclid", "type": "string" }, { - "key": "$session_gad_source", + "key": "$entry_gad_source", "type": "string" }, { diff --git a/posthog/hogql_queries/web_analytics/stats_table.py b/posthog/hogql_queries/web_analytics/stats_table.py index ca56f9160c773..5fd942aaa2647 100644 --- a/posthog/hogql_queries/web_analytics/stats_table.py +++ b/posthog/hogql_queries/web_analytics/stats_table.py @@ -456,17 +456,17 @@ def _counts_breakdown_value(self): case WebStatsBreakdown.ExitPage: return self._apply_path_cleaning(ast.Field(chain=["sessions", "$exit_pathname"])) case WebStatsBreakdown.InitialReferringDomain: - return ast.Field(chain=["sessions", "$session_referring_domain"]) + return ast.Field(chain=["sessions", "$entry_referring_domain"]) case WebStatsBreakdown.InitialUTMSource: - return ast.Field(chain=["sessions", "$session_utm_source"]) + return ast.Field(chain=["sessions", "$entry_utm_source"]) case WebStatsBreakdown.InitialUTMCampaign: - return ast.Field(chain=["sessions", "$session_utm_campaign"]) + return ast.Field(chain=["sessions", "$entry_utm_campaign"]) case WebStatsBreakdown.InitialUTMMedium: - return ast.Field(chain=["sessions", "$session_utm_medium"]) + return ast.Field(chain=["sessions", "$entry_utm_medium"]) case WebStatsBreakdown.InitialUTMTerm: - return ast.Field(chain=["sessions", "$session_utm_term"]) + return ast.Field(chain=["sessions", "$entry_utm_term"]) case WebStatsBreakdown.InitialUTMContent: - return ast.Field(chain=["sessions", "$session_utm_content"]) + return ast.Field(chain=["sessions", "$entry_utm_content"]) case WebStatsBreakdown.InitialChannelType: return ast.Field(chain=["sessions", "$channel_type"]) case WebStatsBreakdown.Browser: