Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(web-analytics): Cleanup feature flags #26976

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 0 additions & 7 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,14 @@ export const FEATURE_FLAGS = {
SETTINGS_BOUNCE_RATE_PAGE_VIEW_MODE: 'settings-bounce-rate-page-view-mode', // owner: @robbie-c
ONBOARDING_DASHBOARD_TEMPLATES: 'onboarding-dashboard-templates', // owner: @raquelmsmith
MULTIPLE_BREAKDOWNS: 'multiple-breakdowns', // owner: @skoob13 #team-product-analytics
WEB_ANALYTICS_LIVE_USER_COUNT: 'web-analytics-live-user-count', // owner: @robbie-c
SETTINGS_SESSION_TABLE_VERSION: 'settings-session-table-version', // owner: @robbie-c
INSIGHT_FUNNELS_USE_UDF: 'insight-funnels-use-udf', // owner: @aspicer #team-product-analytics
INSIGHT_FUNNELS_USE_UDF_TRENDS: 'insight-funnels-use-udf-trends', // owner: @aspicer #team-product-analytics
FIRST_TIME_FOR_USER_MATH: 'first-time-for-user-math', // owner: @skoob13 #team-product-analytics
MULTITAB_EDITOR: 'multitab-editor', // owner: @EDsCODE #team-data-warehouse
WEB_ANALYTICS_REPLAY: 'web-analytics-replay', // owner: @robbie-c
BATCH_EXPORTS_POSTHOG_HTTP: 'posthog-http-batch-exports',
EXPERIMENT_MAKE_DECISION: 'experiment-make-decision', // owner: @jurajmajerik #team-feature-success
DATA_MODELING: 'data-modeling', // owner: @EDsCODE #team-data-warehouse
WEB_ANALYTICS_CONVERSION_GOALS: 'web-analytics-conversion-goals', // owner: @robbie-c
WEB_ANALYTICS_LAST_CLICK: 'web-analytics-last-click', // owner: @robbie-c
WEB_ANALYTICS_LCP_SCORE: 'web-analytics-lcp-score', // owner: @robbie-c
HEDGEHOG_SKIN_SPIDERHOG: 'hedgehog-skin-spiderhog', // owner: @benjackwhite
INSIGHT_VARIABLES: 'insight_variables', // owner: @Gilbert09 #team-data-warehouse
WEB_EXPERIMENTS: 'web-experiments', // owner: @team-feature-success
Expand All @@ -225,13 +220,11 @@ export const FEATURE_FLAGS = {
BILLING_TRIAL_FLOW: 'billing-trial-flow', // owner: @zach
EDIT_DWH_SOURCE_CONFIG: 'edit_dwh_source_config', // owner: @Gilbert09 #team-data-warehouse
AI_SURVEY_RESPONSE_SUMMARY: 'ai-survey-response-summary', // owner: @pauldambra
CUSTOM_CHANNEL_TYPE_RULES: 'custom-channel-type-rules', // owner: @robbie-c #team-web-analytics
SELF_SERVE_CREDIT_OVERRIDE: 'self-serve-credit-override', // owner: @zach
FEATURE_MANAGEMENT_UI: 'feature-management-ui', // owner: @haven #team-feature-flags
CUSTOM_CSS_THEMES: 'custom-css-themes', // owner: @daibhin
METALYTICS: 'metalytics', // owner: @surbhi
EXPERIMENTS_MULTIPLE_METRICS: 'experiments-multiple-metrics', // owner: @jurajmajerik #team-experiments
WEB_ANALYTICS_WARN_CUSTOM_EVENT_NO_SESSION: 'web-analytics-warn-custom-event-no-session', // owner: @robbie-c #team-web-analytics
REMOTE_CONFIG: 'remote-config', // owner: @benjackwhite
SITE_DESTINATIONS: 'site-destinations', // owner: @mariusandra #team-cdp
SITE_APP_FUNCTIONS: 'site-app-functions', // owner: @mariusandra #team-cdp
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/queries/nodes/WebOverview/WebOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import { IconTrending } from '@posthog/icons'
import { LemonSkeleton } from '@posthog/lemon-ui'
import { useValues } from 'kea'
import { getColorVar } from 'lib/colors'
import { FEATURE_FLAGS } from 'lib/constants'
import { IconTrendingDown, IconTrendingFlat } from 'lib/lemon-ui/icons'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { humanFriendlyDuration, humanFriendlyLargeNumber, isNotNil, range } from 'lib/utils'
import { useState } from 'react'

Expand Down Expand Up @@ -42,14 +40,13 @@ export function WebOverview(props: {
onData,
dataNodeCollectionId: dataNodeCollectionId ?? key,
})
const { featureFlags } = useValues(featureFlagLogic)
const { response, responseLoading } = useValues(logic)

const webOverviewQueryResponse = response as WebOverviewQueryResponse | undefined

const samplingRate = webOverviewQueryResponse?.samplingRate

const numSkeletons = props.query.conversionGoal ? 4 : featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_LCP_SCORE] ? 6 : 5
const numSkeletons = props.query.conversionGoal ? 4 : 6

return (
<>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/scenes/settings/SettingsMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ export const SETTINGS_MAP: SettingSection[] = [
component: <CustomChannelTypes />,
},
],
flag: 'CUSTOM_CHANNEL_TYPE_RULES',
},

{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { useValues } from 'kea'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { Link } from 'lib/lemon-ui/Link'
import { ConversionGoalWarning, webAnalyticsLogic } from 'scenes/web-analytics/webAnalyticsLogic'

export const WebAnalyticsHealthCheck = (): JSX.Element | null => {
const { statusCheck, conversionGoalWarning } = useValues(webAnalyticsLogic)
const isFlagConversionGoalWarningsSet = useFeatureFlag('WEB_ANALYTICS_WARN_CUSTOM_EVENT_NO_SESSION')

if (conversionGoalWarning && isFlagConversionGoalWarningsSet) {
if (conversionGoalWarning) {
switch (conversionGoalWarning) {
case ConversionGoalWarning.CustomEventWithNoSessionId:
return (
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/scenes/web-analytics/WebDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const Filters = (): JSX.Element => {
} = useValues(webAnalyticsLogic)
const { setWebAnalyticsFilters, setDates, setCompareFilter } = useActions(webAnalyticsLogic)
const { mobileLayout } = useValues(navigationLogic)
const { conversionGoal } = useValues(webAnalyticsLogic)
const { featureFlags } = useValues(featureFlagLogic)

return (
Expand All @@ -63,9 +62,7 @@ const Filters = (): JSX.Element => {
setWebAnalyticsFilters={setWebAnalyticsFilters}
webAnalyticsFilters={webAnalyticsFilters}
/>
{featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_CONVERSION_GOALS] || conversionGoal ? (
<WebConversionGoal />
) : null}
<WebConversionGoal />
<ReloadAll />
</div>
<div className="bg-border h-px w-full mt-2" />
Expand Down
21 changes: 9 additions & 12 deletions frontend/src/scenes/web-analytics/liveWebAnalyticsLogic.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { actions, connect, events, kea, listeners, path, reducers, selectors } from 'kea'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { liveEventsHostOrigin } from 'lib/utils/apiHost'
import { teamLogic } from 'scenes/teamLogic'
Expand Down Expand Up @@ -78,20 +77,18 @@ export const liveEventsTableLogic = kea<liveEventsTableLogicType>([
}
},
})),
events(({ actions, cache, values }) => ({
events(({ actions, cache }) => ({
afterMount: () => {
if (values.featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_LIVE_USER_COUNT]) {
actions.setNow({ now: new Date() })
actions.pollStats()
actions.setNow({ now: new Date() })
actions.pollStats()

cache.statsInterval = setInterval(() => {
actions.pollStats()
}, 30000)
cache.statsInterval = setInterval(() => {
actions.pollStats()
}, 30000)

cache.nowInterval = setInterval(() => {
actions.setNow({ now: new Date() })
}, 500)
}
cache.nowInterval = setInterval(() => {
actions.setNow({ now: new Date() })
}, 500)
},
beforeUnmount: () => {
if (cache.statsInterval) {
Expand Down
121 changes: 53 additions & 68 deletions frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import api from 'lib/api'
import { FEATURE_FLAGS, RETENTION_FIRST_TIME, STALE_EVENT_SECONDS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
import { Link, PostHogComDocsURL } from 'lib/lemon-ui/Link/Link'
import { featureFlagLogic, FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { getDefaultInterval, isNotNil, objectsEqual, updateDatesWithInterval } from 'lib/utils'
import { errorTrackingQuery } from 'scenes/error-tracking/queries'
import { urls } from 'scenes/urls'
Expand Down Expand Up @@ -696,7 +696,7 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
compareFilter,
filterTestAccounts,
conversionGoal,
includeLCPScore: featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_LCP_SCORE] ? true : undefined,
includeLCPScore: true,
},
insightProps: createInsightProps(TileId.OVERVIEW),
canOpenModal: false,
Expand Down Expand Up @@ -870,45 +870,43 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
},
}
),
featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_LAST_CLICK]
? {
id: PathTab.EXIT_CLICK,
title: 'Outbound link clicks',
linkText: 'Outbound clicks',
query: {
full: true,
kind: NodeKind.DataTableNode,
source: {
kind: NodeKind.WebExternalClicksTableQuery,
properties: webAnalyticsFilters,
dateRange,
compareFilter,
sampling,
limit: 10,
filterTestAccounts,
conversionGoal: featureFlags[
FEATURE_FLAGS.WEB_ANALYTICS_CONVERSION_GOAL_FILTERS
]
? conversionGoal
: undefined,
stripQueryParams: shouldStripQueryParams,
},
embedded: false,
columns: ['url', 'visitors', 'clicks'],
},
insightProps: createInsightProps(TileId.PATHS, PathTab.END_PATH),
canOpenModal: true,
docs: {
title: 'Outbound Clicks',
description: (
<div>
You'll be able to verify when someone leaves your website by
clicking an outbound link (to a separate domain)
</div>
),
},
}
: null,
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View this with whitespace changes disabled

id: PathTab.EXIT_CLICK,
title: 'Outbound link clicks',
linkText: 'Outbound clicks',
query: {
full: true,
kind: NodeKind.DataTableNode,
source: {
kind: NodeKind.WebExternalClicksTableQuery,
properties: webAnalyticsFilters,
dateRange,
compareFilter,
sampling,
limit: 10,
filterTestAccounts,
conversionGoal: featureFlags[
FEATURE_FLAGS.WEB_ANALYTICS_CONVERSION_GOAL_FILTERS
]
? conversionGoal
: undefined,
stripQueryParams: shouldStripQueryParams,
},
embedded: false,
columns: ['url', 'visitors', 'clicks'],
},
insightProps: createInsightProps(TileId.PATHS, PathTab.END_PATH),
canOpenModal: true,
docs: {
title: 'Outbound Clicks',
description: (
<div>
You'll be able to verify when someone leaves your website by clicking an
outbound link (to a separate domain)
</div>
),
},
},
] as (TabsTileTab | undefined)[]
).filter(isNotNil),
},
Expand Down Expand Up @@ -939,21 +937,15 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
Channels are the different sources that bring traffic to your
website, e.g. Paid Search, Organic Social, Direct, etc.
</p>
{featureFlags[FEATURE_FLAGS.CUSTOM_CHANNEL_TYPE_RULES] && (
<p>
You can also{' '}
<Link
to={urls.settings(
'environment-web-analytics',
'channel-type'
)}
>
create custom channel types
</Link>
, allowing you to further categorize your channels.
</p>
)}

<p>
You can also{' '}
<Link
to={urls.settings('environment-web-analytics', 'channel-type')}
>
create custom channel types
</Link>
, allowing you to further categorize your channels.
</p>
<p>
Something unexpected? Try the{' '}
<Link to={urls.sessionAttributionExplorer()}>
Expand Down Expand Up @@ -1276,7 +1268,7 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
}
: null,
// Hiding if conversionGoal is set already because values aren't representative
!conversionGoal && featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_CONVERSION_GOALS]
!conversionGoal
? {
kind: 'query',
tileId: TileId.GOALS,
Expand Down Expand Up @@ -1323,7 +1315,7 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
},
}
: null,
!conversionGoal && featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_REPLAY]
!conversionGoal
? {
kind: 'replay',
tileId: TileId.REPLAY,
Expand Down Expand Up @@ -1825,8 +1817,7 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
checkCustomEventConversionGoalHasSessionIdsHelper(
conversionGoal,
breakpoint,
actions.setConversionGoalWarning,
values.featureFlags
actions.setConversionGoalWarning
),
],
}
Expand All @@ -1835,8 +1826,7 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
checkCustomEventConversionGoalHasSessionIdsHelper(
values.conversionGoal,
undefined,
actions.setConversionGoalWarning,
values.featureFlags
actions.setConversionGoalWarning
).catch(() => {
// ignore, this warning is just a nice-to-have, no point showing an error to the user
})
Expand All @@ -1851,13 +1841,8 @@ const isDefinitionStale = (definition: EventDefinition | PropertyDefinition): bo
const checkCustomEventConversionGoalHasSessionIdsHelper = async (
conversionGoal: WebAnalyticsConversionGoal | null,
breakpoint: BreakPointFunction | undefined,
setConversionGoalWarning: (warning: ConversionGoalWarning | null) => void,
featureFlags: FeatureFlagsSet
setConversionGoalWarning: (warning: ConversionGoalWarning | null) => void
): Promise<void> => {
if (!featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_WARN_CUSTOM_EVENT_NO_SESSION]) {
return
}

if (!conversionGoal || !('customEventName' in conversionGoal) || !conversionGoal.customEventName) {
setConversionGoalWarning(null)
return
Expand Down
Loading