-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web-analytics): Add option behind FF to switch to V2 web analyti…
…cs (#23364)
- Loading branch information
Showing
7 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
frontend/src/scenes/settings/project/SessionsTableVersion.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { useActions, useValues } from 'kea' | ||
import { LemonButton } from 'lib/lemon-ui/LemonButton' | ||
import { LemonRadio, LemonRadioOption } from 'lib/lemon-ui/LemonRadio' | ||
import { eventUsageLogic } from 'lib/utils/eventUsageLogic' | ||
import { useState } from 'react' | ||
import { teamLogic } from 'scenes/teamLogic' | ||
|
||
import { HogQLQueryModifiers } from '~/queries/schema' | ||
|
||
type SessionTableVersion = NonNullable<HogQLQueryModifiers['sessionTableVersion']> | ||
|
||
const bounceRatePageViewModeOptions: LemonRadioOption<SessionTableVersion>[] = [ | ||
{ | ||
value: 'auto', | ||
label: ( | ||
<> | ||
<div>Auto</div> | ||
</> | ||
), | ||
}, | ||
{ | ||
value: 'v1', | ||
label: ( | ||
<> | ||
<div>Version 1</div> | ||
</> | ||
), | ||
}, | ||
{ | ||
value: 'v2', | ||
label: ( | ||
<> | ||
<div>Version 2</div> | ||
</> | ||
), | ||
}, | ||
] | ||
|
||
export function SessionsTableVersion(): JSX.Element { | ||
const { updateCurrentTeam } = useActions(teamLogic) | ||
const { currentTeam } = useValues(teamLogic) | ||
const { reportSessionTableVersionUpdated } = useActions(eventUsageLogic) | ||
|
||
const savedSessionTableVersion = | ||
currentTeam?.modifiers?.sessionTableVersion ?? currentTeam?.default_modifiers?.sessionTableVersion ?? 'auto' | ||
const [sessionTableVersion, setSessionTableVersion] = useState<SessionTableVersion>(savedSessionTableVersion) | ||
|
||
const handleChange = (version: SessionTableVersion): void => { | ||
updateCurrentTeam({ modifiers: { ...currentTeam?.modifiers, sessionTableVersion: version } }) | ||
reportSessionTableVersionUpdated(version) | ||
} | ||
|
||
return ( | ||
<> | ||
<p> | ||
Choose which version of the session table to use. V2 is faster, but requires uuidv7 session ids. Use | ||
auto unless you know what you're doing. | ||
</p> | ||
<LemonRadio | ||
value={sessionTableVersion} | ||
onChange={setSessionTableVersion} | ||
options={bounceRatePageViewModeOptions} | ||
/> | ||
<div className="mt-4"> | ||
<LemonButton | ||
type="primary" | ||
onClick={() => handleChange(sessionTableVersion)} | ||
disabledReason={sessionTableVersion === savedSessionTableVersion ? 'No changes to save' : undefined} | ||
> | ||
Save | ||
</LemonButton> | ||
</div> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters