-
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 health check warnings (#18572)
* Add web analytics health check via the event definition api * Let kea-typegen figure out types * Add a margin to the pageleave warning
- Loading branch information
Showing
4 changed files
with
98 additions
and
9 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
frontend/src/scenes/web-analytics/WebAnalyticsHealthCheck.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,43 @@ | ||
import { useValues } from 'kea' | ||
import { LemonBanner } from 'lib/lemon-ui/LemonBanner' | ||
import { Link } from 'lib/lemon-ui/Link' | ||
import { webAnalyticsLogic } from 'scenes/web-analytics/webAnalyticsLogic' | ||
|
||
export const WebAnalyticsHealthCheck = (): JSX.Element | null => { | ||
const { statusCheck } = useValues(webAnalyticsLogic) | ||
|
||
// No need to show loading or error states for this warning | ||
if (!statusCheck) { | ||
return null | ||
} | ||
|
||
if (statusCheck.shouldWarnAboutNoPageviews) { | ||
return ( | ||
<LemonBanner type={'warning'} className={'mt-2'}> | ||
<p> | ||
No <code>$pageview</code>{' '} | ||
{statusCheck.shouldWarnAboutNoPageleaves ? ( | ||
<> | ||
or <code>$pageleave</code>{' '} | ||
</> | ||
) : null} | ||
events have been received, please read{' '} | ||
<Link to={'https://posthog.com/docs/product-analytics/capture-events'}>the documentation</Link> and | ||
fix this before using Web Analytics. | ||
</p> | ||
</LemonBanner> | ||
) | ||
} else if (statusCheck.shouldWarnAboutNoPageleaves) { | ||
return ( | ||
<LemonBanner type={'warning'} className={'mt-2'}> | ||
<p> | ||
No <code>$pageleave</code> events have been received, this means that Bounce rate and Session | ||
Duration might be inaccurate. Please read{' '} | ||
<Link to={'https://posthog.com/docs/product-analytics/capture-events'}>the documentation</Link> and | ||
fix this before using Web Analytics. | ||
</p> | ||
</LemonBanner> | ||
) | ||
} | ||
return null | ||
} |
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