mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-11 05:46:50 +08:00
try catch
This commit is contained in:
parent
9340f9bedc
commit
025aeb6f30
1 changed files with 8 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import {
|
|||
setAnalyticsCollectionEnabled,
|
||||
} from "firebase/analytics";
|
||||
import { app as firebaseApp } from "../firebase";
|
||||
import { createErrorMessage } from "../utils/misc";
|
||||
|
||||
export let Analytics: AnalyticsType;
|
||||
|
||||
|
|
@ -37,9 +38,10 @@ if (acceptedCookies !== null) {
|
|||
}
|
||||
|
||||
export function activateAnalytics(): void {
|
||||
Analytics = getAnalytics(firebaseApp);
|
||||
setAnalyticsCollectionEnabled(Analytics, true);
|
||||
$("body").append(`
|
||||
try {
|
||||
Analytics = getAnalytics(firebaseApp);
|
||||
setAnalyticsCollectionEnabled(Analytics, true);
|
||||
$("body").append(`
|
||||
<script
|
||||
async
|
||||
src="https://www.googletagmanager.com/gtag/js?id=UA-165993088-1"
|
||||
|
|
@ -53,4 +55,7 @@ export function activateAnalytics(): void {
|
|||
|
||||
gtag("config", "UA-165993088-1");
|
||||
</script>`);
|
||||
} catch (e) {
|
||||
console.error(createErrorMessage(e, "Failed to activate analytics"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue