0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 13:39:22 +01:00

fix(web-analytics): Update kea router, and store conversion goals as flat parameters rather than JSON in URL (#25332)

This commit is contained in:
Robbie 2024-10-02 15:58:42 +01:00 committed by GitHub
parent 45ad457046
commit fafeeaae1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 13 deletions

View File

@ -679,7 +679,7 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
])
: null,
!conversionGoal
? createGraphsTrendsTab(GraphsTab.NUM_SESSION, 'Unique visitors', 'Visitors', [
? createGraphsTrendsTab(GraphsTab.NUM_SESSION, 'Unique sessions', 'Sessions', [
sessionsSeries,
])
: null,
@ -1345,7 +1345,11 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
urlParams.set('filters', JSON.stringify(webAnalyticsFilters))
}
if (conversionGoal) {
urlParams.set('conversionGoal', JSON.stringify(conversionGoal))
if ('actionId' in conversionGoal) {
urlParams.set('conversionGoal.actionId', conversionGoal.actionId.toString())
} else {
urlParams.set('conversionGoal.customEventName', conversionGoal.customEventName)
}
}
if (dateFrom !== initialDateFrom || dateTo !== initialDateTo || interval !== initialInterval) {
urlParams.set('date_from', dateFrom ?? '')
@ -1395,7 +1399,8 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
_,
{
filters,
conversionGoal,
'conversionGoal.actionId': conversionGoalActionId,
'conversionGoal.customEventName': conversionGoalCustomEventName,
date_from,
date_to,
interval,
@ -1413,8 +1418,10 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
if (parsedFilters) {
actions.setWebAnalyticsFilters(parsedFilters)
}
if (conversionGoal) {
actions.setConversionGoal(conversionGoal)
if (conversionGoalActionId) {
actions.setConversionGoal({ actionId: parseInt(conversionGoalActionId, 10) })
} else if (conversionGoalCustomEventName) {
actions.setConversionGoal({ customEventName: conversionGoalCustomEventName })
}
if (date_from || date_to || interval) {
actions.setDatesAndInterval(date_from, date_to, interval)

View File

@ -136,7 +136,7 @@
"kea-forms": "^3.2.0",
"kea-loaders": "^3.0.0",
"kea-localstorage": "^3.1.0",
"kea-router": "^3.1.4",
"kea-router": "^3.2.0",
"kea-subscriptions": "^3.0.1",
"kea-test-utils": "^0.2.4",
"kea-waitfor": "^0.2.1",

View File

@ -230,8 +230,8 @@ dependencies:
specifier: ^3.1.0
version: 3.1.0(kea@3.1.5)
kea-router:
specifier: ^3.1.4
version: 3.1.4(kea@3.1.5)
specifier: ^3.2.0
version: 3.2.0(kea@3.1.5)
kea-subscriptions:
specifier: ^3.0.1
version: 3.0.1(kea@3.1.5)
@ -15304,8 +15304,8 @@ packages:
kea: 3.1.5(react@18.2.0)
dev: false
/kea-router@3.1.4(kea@3.1.5):
resolution: {integrity: sha512-KjATA2vwh90GDcO3iiUrQwhRSzRbvyplvtyDzEWevfSHccbrtxdDm/ZCApAvMACPZZH0Klk4aHk1ZAZ1DJtcbg==}
/kea-router@3.2.0(kea@3.1.5):
resolution: {integrity: sha512-TZVHrQQNhD7tSL05xEXoNCeYu/vwwvxBc316pgwi5z8cH61MtCcUBUEZnWr2Nd7jSBDgxA/GRHpqai0YXq0T8w==}
peerDependencies:
kea: '>= 3'
dependencies:
@ -18334,7 +18334,7 @@ packages:
react: '>=15'
dependencies:
react: 18.2.0
unlayer-types: 1.103.0
unlayer-types: 1.111.0
dev: false
/react-error-boundary@3.1.4(react@18.2.0):
@ -20881,8 +20881,8 @@ packages:
resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==}
engines: {node: '>= 10.0.0'}
/unlayer-types@1.103.0:
resolution: {integrity: sha512-aVZS7g5F6dWEoxc0dhSDqYYncu+LIMB/SerJi6u5FKVSfTWnzA2MTpjFCbGkOOi8rUiIOabeuEOfyO/WDnarJg==}
/unlayer-types@1.111.0:
resolution: {integrity: sha512-CjdOROIUrZXrtkLUrInMvTucEWRdWWEmPleCOhwsDTwUXg9LocjzI6drgdYoia/lyyoYPfHOXYw5SxdJk7hlvw==}
dev: false
/unpipe@1.0.0: