Add custom properties argument to useTrackMetric (#1779)
This commit is contained in:
Родитель
5cda5f7d29
Коммит
52cdf2e266
|
@ -1,5 +1,5 @@
|
|||
import { useEffect, useRef } from "react";
|
||||
import { dateNow } from "@microsoft/applicationinsights-core-js";
|
||||
import { dateNow, ICustomProperties } from "@microsoft/applicationinsights-core-js";
|
||||
import ReactPlugin from "./ReactPlugin";
|
||||
|
||||
interface ITrackedData {
|
||||
|
@ -24,7 +24,8 @@ function getEngagementTimeSeconds(trackedData: ITrackedData) {
|
|||
|
||||
const useComponentTracking = (
|
||||
reactPlugin: ReactPlugin,
|
||||
componentName: string
|
||||
componentName: string,
|
||||
customProperties?: ICustomProperties
|
||||
) => {
|
||||
const tracking = useRef<ITrackedData>({
|
||||
hookTimestamp: dateNow(),
|
||||
|
@ -76,7 +77,7 @@ const useComponentTracking = (
|
|||
sampleCount: 1
|
||||
};
|
||||
|
||||
const additionalProperties = { "Component Name": componentName };
|
||||
const additionalProperties = { "Component Name": componentName, ...customProperties };
|
||||
reactPlugin.trackMetric(metricData, additionalProperties);
|
||||
};
|
||||
}, []);
|
||||
|
|
Загрузка…
Ссылка в новой задаче