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:
10
App.tsx
10
App.tsx
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -13,7 +13,7 @@ export type CtaData = {
|
||||
|
||||
export type AnalyticsEvent = {
|
||||
name: string;
|
||||
properties?: Map<string, string>;
|
||||
properties?: Record<string, string>;
|
||||
};
|
||||
|
||||
type LineItem = {
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user