TP-72224 | Adding support for event properties on Quote Page (#11634)

Co-authored-by: Shivam Goyal <shivam.goyal@navi.com>
Co-authored-by: Kishan Kumar <kishan.kumar@navi.com>
Co-authored-by: Aditya Piyush <aditya.piyush@navi.com>
Co-authored-by: Saksham Mahajan <saksham.mahajan@navi.com>
Co-authored-by: Prakhar Saxena <prakhar.saxena@navi.com>
Co-authored-by: Anmol Agrawal <anmol.agrawal@navi.com>
Co-authored-by: Anupam Kumar <anupam.kumar@navi.com>
Co-authored-by: Hitesh Kumar <hitesh.kumar@navi.com>
Co-authored-by: abhinavgupta <abhinav.g@navi.com>
Co-authored-by: Varun Jain <varun.jain@navi.com>
Co-authored-by: Kshitij Pramod Ghongadi <kshitij.pramod@navi.com>
This commit is contained in:
Prajjaval Verma
2024-07-02 14:02:30 +05:30
committed by GitHub
parent b7f8d68bed
commit 85638c1371
4 changed files with 24 additions and 37 deletions

10
App.tsx
View File

@@ -21,7 +21,7 @@ import {
getStringPreference,
setStringPreference,
} from "./App/common/utilities/SharedPreferenceUtils";
import { useAnalyticsEvent } from "./App/common/hooks/useAnalyticsEvent";
import { sendAsAnalyticsEvent } from "./App/common/hooks/useAnalyticsEvent";
import {
EVENT_NAMES,
EVENT_PROPERTY_KEYS,
@@ -67,8 +67,6 @@ export default class App extends Component<{}, AppState> {
};
onCodepushStatusChange = (status: codePush.SyncStatus) => {
const { sendAsAnalyticsEvent, sendAsGlobalErrorEvent } =
useAnalyticsEvent();
switch (status) {
case codePush.SyncStatus.CHECKING_FOR_UPDATE:
case codePush.SyncStatus.DOWNLOADING_PACKAGE:
@@ -91,9 +89,9 @@ export default class App extends Component<{}, AppState> {
this.setState({ bundleState: BundleState.ERROR });
sendAsAnalyticsEvent({
name: EVENT_NAMES.CODEPUSH_FETCH_ERROR,
properties: new Map([
[EVENT_PROPERTY_KEYS.STATUS, EVENT_PROPERTY_VALUES.UNKNOWN_ERROR],
]),
properties: {
[EVENT_PROPERTY_KEYS.STATUS] : EVENT_PROPERTY_VALUES.UNKNOWN_ERROR
}
});
storeBundleStatus(BundleState.ERROR);
logToSentry(

View File

@@ -12,11 +12,11 @@ export const useAnalyticsEvent = () => {
};
export const sendAsAnalyticsEvent = (analyticsEvent: AnalyticsEvent) => {
const propertiesWithBundleVersion = {
...analyticsEvent.properties,
let propertiesWithBundleVersion: Record<string,string> | undefined = analyticsEvent.properties
propertiesWithBundleVersion = {
...propertiesWithBundleVersion,
[EVENT_PROPERTY_KEYS.BUNDLE_VERSION]: getBundleVersion().toString(),
};
}
NativeAnalyticsModule.sendAsAnalyticsEvent(
analyticsEvent.name,
propertiesWithBundleVersion,

View File

@@ -13,7 +13,7 @@ export type CtaData = {
export type AnalyticsEvent = {
name: string;
properties?: Map<string, string>;
properties?: Record<string, string>;
};
type LineItem = {

View File

@@ -56,20 +56,14 @@ const SumInsuredWidget = ({
}
const clickEvent: AnalyticsEvent = {
name: AnalyticsEventNameConstants.HI_SI_PILLS_CLICK,
properties: new Map([
[
AnalyticsEventPropertyConstants.SUM_INSURED,
widgetData?.carouselListData
?.at(index - 1)
?.sumInsured?.toString() ?? "",
],
[
AnalyticsEventPropertyConstants.TAG,
widgetData?.widgetMetaData?.recommendItemIndex === index - 1
? AnalyticsEventPropertyConstants.RECOMMENDED
: AnalyticsEventPropertyConstants.NOT_RECOMMENDED,
],
]),
properties: {
[AnalyticsEventPropertyConstants.SUM_INSURED] : widgetData?.carouselListData
?.at(index - 1)
?.sumInsured?.toString() ?? "",
[AnalyticsEventPropertyConstants.TAG] : widgetData?.widgetMetaData?.recommendItemIndex === index - 1
? AnalyticsEventPropertyConstants.RECOMMENDED
: AnalyticsEventPropertyConstants.NOT_RECOMMENDED
}
};
sendAsAnalyticsEvent(clickEvent);
}
@@ -135,18 +129,13 @@ const SumInsuredWidget = ({
}
const clickEvent: AnalyticsEvent = {
name: AnalyticsEventNameConstants.HI_SI_PILLS_CLICK,
properties: new Map([
[
AnalyticsEventPropertyConstants.SUM_INSURED,
widgetData?.carouselListData?.at(index)?.sumInsured?.toString() ?? "",
],
[
AnalyticsEventPropertyConstants.TAG,
widgetData?.widgetMetaData?.recommendItemIndex === index
? AnalyticsEventPropertyConstants.RECOMMENDED
: AnalyticsEventPropertyConstants.NOT_RECOMMENDED,
],
]),
properties:
{
[AnalyticsEventPropertyConstants.SUM_INSURED] : widgetData?.carouselListData?.at(index)?.sumInsured?.toString() ?? "",
[AnalyticsEventPropertyConstants.TAG] : widgetData?.widgetMetaData?.recommendItemIndex === index
? AnalyticsEventPropertyConstants.RECOMMENDED
: AnalyticsEventPropertyConstants.NOT_RECOMMENDED,
}
};
sendAsAnalyticsEvent(clickEvent);
};