Skip to content

Commit

Permalink
feat: Added analytics events for telemetry callout (#24505)
Browse files Browse the repository at this point in the history
Added analytics events for interaction with telemetry notification post
instance setup is complete

#### PR fixes following issue(s)
Fixes # appsmithorg/cloud-services#908

#### Type of change
- New feature (non-breaking change which adds functionality)

Local QA - https://www.loom.com/share/8d0d266f2f2d409fb19c23c967c7d548
DP QA - https://www.loom.com/share/348f8d19fea74994ba581ca750703542
https://www.loom.com/share/b47ba6c2b1f7448084676baad7c47ad8

>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
  • Loading branch information
ankitsrivas14 authored and ankitakinger committed Jun 19, 2023
1 parent dd6113e commit 3e48d83
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useEffect } from "react";
import { Callout } from "design-system";
import {
ADMIN_SETTINGS,
Expand All @@ -8,10 +8,24 @@ import {
} from "@appsmith/constants/messages";
import { ADMIN_SETTINGS_CATEGORY_DEFAULT_PATH } from "constants/routes";
import { TELEMETRY_DOCS_PAGE_URL } from "./constants";
import AnalyticsUtil from "utils/AnalyticsUtil";

export default function AnonymousDataPopup(props: {
onCloseCallout: () => void;
}) {
useEffect(() => {
AnalyticsUtil.logEvent("DISPLAY_TELEMETRY_CALLOUT");
}, []);

const handleLinkClick = (link: string) => {
if (link === ADMIN_SETTINGS_CATEGORY_DEFAULT_PATH) {
AnalyticsUtil.logEvent("VISIT_ADMIN_SETTINGS_TELEMETRY_CALLOUT");
} else if (link === TELEMETRY_DOCS_PAGE_URL) {
AnalyticsUtil.logEvent("LEARN_MORE_TELEMETRY_CALLOUT");
}
window.open(link, "_blank");
};

return (
<div className="absolute top-5">
<Callout
Expand All @@ -20,11 +34,12 @@ export default function AnonymousDataPopup(props: {
links={[
{
children: createMessage(ADMIN_SETTINGS),
to: ADMIN_SETTINGS_CATEGORY_DEFAULT_PATH,
onClick: () =>
handleLinkClick(ADMIN_SETTINGS_CATEGORY_DEFAULT_PATH),
},
{
children: createMessage(LEARN_MORE),
to: TELEMETRY_DOCS_PAGE_URL,
onClick: () => handleLinkClick(TELEMETRY_DOCS_PAGE_URL),
},
]}
onClose={() => {
Expand Down
5 changes: 4 additions & 1 deletion app/client/src/utils/AnalyticsUtil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ export type EventName =
| "GOOGLE_SHEET_FILE_PICKER_CANCEL"
| "GOOGLE_SHEET_FILE_PICKER_PICKED"
| "TELEMETRY_DISABLED"
| "DISPLAY_TELEMETRY_CALLOUT"
| "VISIT_ADMIN_SETTINGS_TELEMETRY_CALLOUT"
| "LEARN_MORE_TELEMETRY_CALLOUT"
| AI_EVENTS
| ONE_CLICK_BINDING_EVENT_NAMES;

Expand Down Expand Up @@ -513,9 +516,9 @@ class AnalyticsUtil {
finalEventData = {
...eventData,
userData: user.userId === ANONYMOUS_USERNAME ? undefined : user,
instanceId,
};
}
finalEventData = { ...finalEventData, instanceId };

if (windowDoc.analytics) {
log.debug("Event fired", eventName, finalEventData);
Expand Down

0 comments on commit 3e48d83

Please sign in to comment.