mirror of
https://github.com/XFox111/TabsAsideExtension.git
synced 2026-04-22 07:58:01 +03:00
hotfix: wrapped analytics into try/catch to prevent failing on firefox
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
export { default as userPropertiesStorage } from "./utils/userPropertiesStorage";
|
||||
export { default as trackError } from "./utils/trackError";
|
||||
export { default as track } from "./utils/track";
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
export default function track(eventName: string, eventProperties?: Record<string, string>): void
|
||||
{
|
||||
try
|
||||
{
|
||||
analytics.track(eventName, eventProperties);
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
console.error("Failed to send analytics event", ex);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,15 @@
|
||||
export default function trackError(name: string, error: Error): void
|
||||
{
|
||||
analytics.track(name, {
|
||||
name: error.name,
|
||||
message: error.message,
|
||||
stack: error.stack ?? "no_stack"
|
||||
});
|
||||
try
|
||||
{
|
||||
analytics.track(name, {
|
||||
name: error.name,
|
||||
message: error.message,
|
||||
stack: error.stack ?? "no_stack"
|
||||
});
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
console.error("Failed to send error report", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useTheme } from "@/contexts/ThemeProvider";
|
||||
import { v3blogPost } from "@/data/links";
|
||||
import { track } from "@/features/analytics";
|
||||
import extLink from "@/utils/extLink";
|
||||
import * as fui from "@fluentui/react-components";
|
||||
|
||||
@@ -41,7 +42,7 @@ export default function WelcomeDialog(): React.ReactElement
|
||||
<fui.DialogTrigger disableButtonEnhancement>
|
||||
<fui.Button
|
||||
appearance="primary" as="a" { ...extLink(v3blogPost) }
|
||||
onClick={ () => analytics.track("visit_blog_button_click") }
|
||||
onClick={ () => track("visit_blog_button_click") }
|
||||
>
|
||||
{ i18n.t("features.v3welcome.actions.visit_blog") }
|
||||
</fui.Button>
|
||||
|
||||
Reference in New Issue
Block a user