Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(marketing-analytics): stop counting the date range as a search filter (#130259)

Javier Bahamondes8f283517e0ca
diff --git a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.test.ts b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.test.ts
index 995459d1f9ac..ad4dc401ceee 100644
--- a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.test.ts
+++ b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.test.ts
@@ -164,6 +164,7 @@ describe('marketingAnalyticsLogic', () => {
expect(searchLogic.values.missingSources).toEqual(['GoogleAds'])
logic.actions.setCompareFilter({ compare: true })
logic.actions.setDates('-28d', null)
+ expect(searchLogic.values.hasActiveFilters).toBe(false)
searchLogic.actions.setChannel('paid')
searchLogic.actions.setQuerySearch('missing query')
expect(searchLogic.values.hasActiveFilters).toBe(true)
@@ -174,6 +175,7 @@ describe('marketingAnalyticsLogic', () => {
expect(searchLogic.values.sources.map((source) => source.id)).toEqual(['organic'])
expect(searchLogic.values.query.search).toBe('')
expect(logic.values.compareFilter).toEqual({ compare: true })
+ expect(logic.values.dateFilter.dateFrom).toBe('-28d')
const organicSource = logic.values.dataWarehouseSources!.results[0]
await expectLogic(logic, () =>
logic.actions.loadSourcesSuccess({
diff --git a/products/marketing_analytics/frontend/search/searchPerformanceLogic.ts b/products/marketing_analytics/frontend/search/searchPerformanceLogic.ts
index a8c523c5538b..ca8edd4de2a8 100644
--- a/products/marketing_analytics/frontend/search/searchPerformanceLogic.ts
+++ b/products/marketing_analytics/frontend/search/searchPerformanceLogic.ts
@@ -95,7 +95,7 @@ export interface searchPerformanceLogicActions
extends
Pick<
marketingAnalyticsLogicActions,
- 'loadSources' | 'loadSourcesSuccess' | 'loadSourcesFailure' | 'setIntegrationFilter' | 'setDates'
+ 'loadSources' | 'loadSourcesSuccess' | 'loadSourcesFailure' | 'setIntegrationFilter'
>,
Pick<teamLogicActions, 'updateCurrentTeamSuccess'> {
setWrapText: (wrapText: boolean) => { wrapText: boolean }
@@ -137,7 +137,7 @@ export const searchPerformanceLogic = kea<searchPerformanceLogicType>([
],
actions: [
marketingAnalyticsLogic,
- ['loadSources', 'loadSourcesSuccess', 'loadSourcesFailure', 'setIntegrationFilter', 'setDates'],
+ ['loadSources', 'loadSourcesSuccess', 'loadSourcesFailure', 'setIntegrationFilter'],
teamLogic,
['updateCurrentTeamSuccess'],
],
@@ -219,17 +219,11 @@ export const searchPerformanceLogic = kea<searchPerformanceLogicType>([
),
],
hasActiveFilters: [
- (s) => [s.querySearch, s.channel, s.integrationFilter, s.dateFilter, s.allSearchSources],
- (search, channel, filter, dates, sources: ExternalDataSource[]): boolean => {
+ (s) => [s.querySearch, s.channel, s.integrationFilter, s.allSearchSources],
+ (search, channel, filter, sources: ExternalDataSource[]): boolean => {
const ids = filter.integrationSourceIds ?? []
const allSourcesSelected = sources.length > 0 && sources.every((source) => ids.includes(source.id))
- return (
- !!search.trim() ||
- channel !== 'all' ||
- (ids.length > 0 && !allSourcesSelected) ||
- dates.dateFrom !== '-7d' ||
- !!dates.dateTo
- )
+ return !!search.trim() || channel !== 'all' || (ids.length > 0 && !allSourcesSelected)
},
],
hasSearchConsole: [
@@ -415,7 +409,6 @@ export const searchPerformanceLogic = kea<searchPerformanceLogicType>([
actions.setQuerySearch('')
actions.setChannel('all')
actions.setIntegrationFilter({ ...values.integrationFilter, integrationSourceIds: [] })
- actions.setDates('-7d', null)
},
setBreakdown: ({ breakdown }) => {
if (breakdown === 'search_term') {