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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions frontend/src/lib/components/Sharing/SharingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function SharingModalContent({
iframeProperties,
shareLink,
} = useValues(sharingLogic(logicProps))
const { setIsEnabled, togglePreview } = useActions(sharingLogic(logicProps))
const { setIsEnabled, togglePreview, setEmbedConfigValue } = useActions(sharingLogic(logicProps))
const { guardAvailableFeature } = useValues(upgradeModalLogic)

const [iframeLoaded, setIframeLoaded] = useState(false)
Expand Down Expand Up @@ -159,7 +159,7 @@ export function SharingModalContent({
</LemonField>
)}
<LemonField name="whitelabel">
{({ value, onChange }) => (
{({ value }) => (
<LemonSwitch
fullWidth
bordered
Expand All @@ -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.

)
guardAvailableFeature(AvailableFeature.WHITE_LABELLING, () => {
setEmbedConfigValue('whitelabel', !value)
})
}
checked={!value}
/>
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/lib/components/Sharing/sharingLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ export const sharingLogic = kea<sharingLogicType>([
dashboardsModel.actions.loadDashboards()
}
},
setEmbedConfigValue: ({ name, value }) => {
if (name === 'whitelabel' && props.dashboardId) {
eventUsageLogic.actions.reportDashboardWhitelabelToggled(value)
}
},
})),

forms({
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/lib/utils/eventUsageLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
newLength: number
) => ({ attribute, originalLength, newLength }),
reportDashboardShareToggled: (isShared: boolean) => ({ isShared }),
reportDashboardWhitelabelToggled: (isWhitelabelToggled: boolean) => ({ isWhitelabelToggled }),
reportUpgradeModalShown: (featureName: string) => ({ featureName }),
reportTimezoneComponentViewed: (
component: 'label' | 'indicator',
Expand Down Expand Up @@ -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.

},
reportUpgradeModalShown: async (payload) => {
posthog.capture('upgrade modal shown', payload)
},
Expand Down
Loading