-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SecuritySolution][Onboarding] Send Telemetry when header/footer card…
…s are clicked (#196495) ## Summary #196145 To verify: 1. Add these lines to kibana.dev.yml ``` logging.browser.root.level: debug telemetry.optIn: true ``` \ 2. In the onboarding hub, click on header cards. It should log `onboarding_card_${cardId}` on cards clicked. <img width="1101" alt="Screenshot 2024-10-16 at 10 30 58" src="https://github.com/user-attachments/assets/902848f2-fdc5-412d-bfe0-9ed51ba87c56"> <img width="1258" alt="Screenshot 2024-10-15 at 16 54 32" src="https://github.com/user-attachments/assets/883a49a2-cd78-4438-91bb-21b2842b8893"> \ 3. It should log `onboarding_footer_link_${footerLinkId}` on footer links visited. <img width="1019" alt="Screenshot 2024-10-16 at 10 31 26" src="https://github.com/user-attachments/assets/a7ff80a7-a30d-42e9-84d3-5a14fd243022"> <img width="1200" alt="Screenshot 2024-10-15 at 17 29 59" src="https://github.com/user-attachments/assets/3034ca61-425b-47f5-a415-8bf6065f2c6f"> ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
- Loading branch information
1 parent
d8149bf
commit e38b4df
Showing
10 changed files
with
186 additions
and
25 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/security_solution/public/onboarding/components/constants.ts
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,14 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export const TELEMETRY_HEADER_CARD = `header_card`; | ||
|
||
export enum OnboardingHeaderCardId { | ||
video = 'video', | ||
teammates = 'teammates', | ||
demo = 'demo', | ||
} |
16 changes: 16 additions & 0 deletions
16
x-pack/plugins/security_solution/public/onboarding/components/onboarding_footer/constants.ts
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,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export const TELEMETRY_FOOTER_LINK = `footer_link`; | ||
|
||
export enum OnboardingFooterLinkItemId { | ||
video = 'video', | ||
documentation = 'documentation', | ||
demo = 'demo', | ||
forum = 'forum', | ||
labs = 'labs', | ||
} |
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
52 changes: 52 additions & 0 deletions
52
...curity_solution/public/onboarding/components/onboarding_footer/onboarding_footer.test.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,52 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { trackOnboardingLinkClick } from '../../common/lib/telemetry'; | ||
import { FooterLinkItem } from './onboarding_footer'; | ||
import { OnboardingFooterLinkItemId, TELEMETRY_FOOTER_LINK } from './constants'; | ||
|
||
jest.mock('../../common/lib/telemetry'); | ||
|
||
describe('OnboardingFooterComponent', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('FooterLinkItems should render the title and description', () => { | ||
const { getByText } = render( | ||
<FooterLinkItem | ||
id={OnboardingFooterLinkItemId.documentation} | ||
icon={'mockIcon.png'} | ||
title={'Mock Title'} | ||
description={'Mock Description'} | ||
link={{ title: 'test', href: 'www.mock.com' }} | ||
/> | ||
); | ||
|
||
expect(getByText('Mock Title')).toBeInTheDocument(); | ||
expect(getByText('Mock Description')).toBeInTheDocument(); | ||
}); | ||
|
||
it('FooterLinkItems should track the link click', () => { | ||
const { getByTestId } = render( | ||
<FooterLinkItem | ||
id={OnboardingFooterLinkItemId.documentation} | ||
icon={'mockIcon.png'} | ||
title={'Mock Title'} | ||
description={'Mock Description'} | ||
link={{ title: 'test', href: 'www.mock.com' }} | ||
/> | ||
); | ||
|
||
getByTestId('footerLinkItem').click(); | ||
expect(trackOnboardingLinkClick).toHaveBeenCalledWith( | ||
`${TELEMETRY_FOOTER_LINK}_${OnboardingFooterLinkItemId.documentation}` | ||
); | ||
}); | ||
}); |
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
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