Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding white label event capture for sharing #27140

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

surbhi-posthog
Copy link
Contributor

@surbhi-posthog surbhi-posthog commented Dec 23, 2024

Problem

In this PR, I'm adding whitelabel capture event for sharing dashboards

In the following PR's,

I will add changes to

  • whitelabelling in surveys
  • Shared insights

Changes

The event capture happens in the frontend since this feature is purely built in the frontend.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

Cloud: Yes

How did you test this code?

Shared a dashboards, and toggled the whitelabel button. Verified logs showed up:

image

@surbhi-posthog surbhi-posthog requested a review from a team December 23, 2024 20:06
Copy link
Contributor

github-actions bot commented Dec 23, 2024

Size Change: +197 B (+0.02%)

Total Size: 1.11 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 1.11 MB +197 B (+0.02%)

compressed-size-action

@surbhi-posthog surbhi-posthog changed the title [feat]: adding white label event capture for sharing feat: adding white label event capture for sharing Dec 23, 2024
@surbhi-posthog surbhi-posthog marked this pull request as ready for review December 23, 2024 20:50
Copy link
Contributor

@zlwaterfield zlwaterfield left a comment

Choose a reason for hiding this comment

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

This sharing logic is used across multiple resource types (dashboard, insight, recordings) and it looks like we're already triggering events for dashboard sharing so it might be best to follow that pattern and expand for insights and recordings.

See setIsEnabled listener for the dashboard trigger and SharingLogicProps for the different id props passed in.

@surbhi-posthog
Copy link
Contributor Author

Based on the feedback abo e,

This sharing logic is used across multiple resource types (dashboard, insight, recordings) and it looks like we're already triggering events for dashboard sharing so it might be best to follow that pattern and expand for insights and recordings.

See setIsEnabled listener for the dashboard trigger and SharingLogicProps for the different id props passed in.

I've customized the kea action setConfigValue to log when the user toggles the whitelabel button. I didn't think loaders were necessary here, as this action doesn't trigger any API calls and is handled entirely on the frontend.

I'll add the changes for insights and surveys next.

@surbhi-posthog surbhi-posthog requested review from zlwaterfield and a team December 31, 2024 12:19
Copy link
Contributor

@zlwaterfield zlwaterfield left a comment

Choose a reason for hiding this comment

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

Two suggestions but if those are addressed this looks good.

@@ -174,9 +174,9 @@ export function SharingModalContent({
</div>
}
onChange={() =>
guardAvailableFeature(AvailableFeature.WHITE_LABELLING, () =>
onChange(!value)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should still call onChange here so it we ever save this to the API the form state is updated.

@@ -791,6 +792,9 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportDashboardShareToggled: async ({ isShared }) => {
posthog.capture(`dashboard share toggled`, { is_shared: isShared })
},
reportDashboardWhitelabelToggled: async ({ isWhitelabelToggled }) => {
posthog.capture(`dashboard whitelabel toggled`, { is_whitelabel_toggled: isWhitelabelToggled })
Copy link
Contributor

Choose a reason for hiding this comment

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

I find this attribute a bit confusing is_whitelabelled might be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants