Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Improve exploration UI (#6315)

Adrian Gruntkowski1eaffe895d3a
diff --git a/assets/js/dashboard/extra/exploration.js b/assets/js/dashboard/extra/exploration.js
index 09aecc2467..635fc5aeb9 100644
--- a/assets/js/dashboard/extra/exploration.js
+++ b/assets/js/dashboard/extra/exploration.js
@@ -342,13 +342,14 @@ function CandidateCard({
onSelect
}) {
const isCustomEvent = step.name !== 'pageview'
+ const isGoal = step.is_goal
const visitorsToShow =
isSelected && selectedVisitors !== null ? selectedVisitors : visitors
const barWidth =
isSelected && selectedConversionRate !== null
- ? selectedConversionRate
- : Math.round((visitors / stepMaxVisitors) * 100)
+ ? Math.max(1, selectedConversionRate)
+ : Math.max(1, Math.round((visitors / stepMaxVisitors) * 100))
const textColor = isDimmed
? 'text-gray-400 dark:text-gray-500 group-hover:text-gray-600 dark:group-hover:text-gray-400'
@@ -389,9 +390,9 @@ function CandidateCard({
: step.label
}
>
- {isCustomEvent && (
+ {(isCustomEvent || isGoal) && (
<CursorIcon
- title="Custom event"
+ title={isGoal ? 'Goal' : 'Custom event'}
className={`size-4 shrink-0 ${textColor}`}
/>
)}
@@ -412,9 +413,7 @@ function CandidateCard({
</span>
<span className={`shrink-0 font-medium ${textColor}`}>
- <Tooltip info={numberLongFormatter(visitorsToShow)}>
- {numberShortFormatter(visitorsToShow)}
- </Tooltip>
+ <VisitorsMetric visitors={visitorsToShow} />
</span>
</div>
</button>
@@ -422,6 +421,22 @@ function CandidateCard({
)
}
+function VisitorsMetric({ visitors }) {
+ const shortNumber = numberShortFormatter(visitors)
+ const longNumber = numberLongFormatter(visitors)
+ const showTooltip = shortNumber !== longNumber
+
+ if (showTooltip) {
+ return (
+ <Tooltip info={longNumber} containerRef={{ current: document.body }}>
+ {shortNumber}
+ </Tooltip>
+ )
+ } else {
+ return shortNumber
+ }
+}
+
function ColumnEmptyState({ active, filter, colIndex, direction }) {
if (!active) {
const prompt =