Skip to content

Add explore analytics#13658

Open
dylanjeffers wants to merge 2 commits intomainfrom
explore-analytics
Open

Add explore analytics#13658
dylanjeffers wants to merge 2 commits intomainfrom
explore-analytics

Conversation

@dylanjeffers
Copy link
Contributor

@dylanjeffers dylanjeffers commented Feb 5, 2026

We should analyze usage here and pair back explore page to what's working. helps simplify and improve performance


Note

Low Risk
Adds new analytics events and lightweight tracking hooks around existing explore components; main risk is noisy/duplicate telemetry if view detection triggers unexpectedly.

Overview
Adds Explore analytics events (Name.EXPLORE_SECTION_VIEW / Name.EXPLORE_SECTION_CLICK) and a typed ExploreSectionName union in packages/common/src/models/Analytics.ts.

Wires section impression tracking into web explore carousels and mobile explore sections by replacing useDeferredElement usage with new useExploreSectionTracking hooks that emit a view event when a section enters the viewport.

Adds click tracking for explore interactions (mood selections, quick search presets, and track/playlist/profile card navigation) by emitting Explore: Section Click with section, source (web/mobile), and optional id/kind/link metadata.

Written by Cursor Bugbot for commit 16b8b26. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2026

⚠️ No Changeset found

Latest commit: 16b8b26

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member

@raymondjacobson raymondjacobson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this data is going to be high quality enough

}) => {
const { user_id, name, handle, follower_count } = user
const { trackEvent } = useAnalytics()
const isMobile = typeof window !== 'undefined' && window.innerWidth < 768
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we have helpers for this?

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

}) => {
const { user_id, name, handle, follower_count } = user
const { trackEvent } = useAnalytics()
const isMobile = typeof window !== 'undefined' && window.innerWidth < 768
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent mobile detection bypasses existing helper hook

Medium Severity

UserArtCard determines isMobile via window.innerWidth < 768, while the sibling components TrackArtCard and CollectionArtCard in the same directory both use the useIsMobile hook (which checks the user agent via useSsrContext). These two approaches can produce different results, meaning the source field in EXPLORE_SECTION_CLICK analytics events could be inconsistent across card types for the same user. The reviewer also flagged this in the PR discussion.

Fix in Cursor Fix in Web

const handleClick = useCallback(() => {
onTrackClick()
onClick()
}, [onClick, onTrackClick])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused onTrackClick prop adds dead code complexity

Low Severity

The new onTrackClick prop on QuickSearchPresetButton is always passed as () => {} (a no-op). A handleClick wrapper was added to call both onTrackClick and onClick, but since all analytics tracking already lives inside handleClickPreset (passed as onClick), the entire onTrackClick plumbing — the prop, the wrapper callback, and the no-op — is dead code that adds unnecessary indirection.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants