diff --git a/package.json b/package.json
index 78702833e80aeb1604288dd62ab3d0f8a5f363ab..ce25f480ebbdfa01737b2cc9d197e786907478a0 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,8 @@
     "vite": "^2.9.13"
   },
   "dependencies": {
+    "@sentry/browser": "^7.5.0",
+    "@sentry/tracing": "^7.5.0",
     "hydrogen-view-sdk": "^0.0.13"
   }
 }
diff --git a/src/main.ts b/src/main.ts
index 481f5be6359398d7c5478dba8dbd271e6cf180fc..45bd83549495d1caeb023155f4bc4677dbca0f83 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -7,6 +7,9 @@ import workerPath from "hydrogen-view-sdk/main.js?url";
 import olmWasmPath from "@matrix-org/olm/olm.wasm?url";
 import olmJsPath from "@matrix-org/olm/olm.js?url";
 import olmLegacyJsPath from "@matrix-org/olm/olm_legacy.js?url";
+import * as Sentry from "@sentry/browser";
+import { BrowserTracing } from "@sentry/tracing";
+
 const assetPaths = {
     downloadSandbox: downloadSandboxPath,
     worker: workerPath,
@@ -41,6 +44,25 @@ async function main() {
     }
     root.className = "hydrogen";
     const config = await fetchConfig();
+
+    if (config.sentry) {
+        Sentry.init({
+            dsn: config.sentry.dsn,
+            environment: config.sentry.environment,
+            integrations: [new BrowserTracing()],
+        });
+        Sentry.setTag("homeserver", config.homeserver);
+        Sentry.setTag("encrypt_room", config.encrypt_room);
+
+        if (config.invite_user) {
+            Sentry.setTag("mode", "invite_user");
+        } else if (config.auto_join_room) {
+            Sentry.setTag("mode", "auto_join_room");
+        } else {
+            Sentry.setTag("mode", "unknown");
+        }
+    }
+
     const platform = new Platform({container: root, assetPaths, config: {}, options: { development: import.meta.env.DEV }});
     const navigation = new Navigation(allowsChild);
     platform.setNavigation(navigation);
@@ -65,6 +87,9 @@ function allowsChild(parent, child) {
 function hideOnError() {
     // When an error occurs, log it and then hide everything!
     const handler = e => {
+        Sentry.captureException(e, { tags: {
+            "fatalError": true
+        }});
         if (e.message === "ResizeObserver loop completed with undelivered notifications." ||
             e.message === "ResizeObserver loop limit exceeded" ||
             // hydrogen renders an <img> with src = undefined while the image is being decrypted
diff --git a/src/types/IChatterboxConfig.ts b/src/types/IChatterboxConfig.ts
index 7883b127050e139e7116f959a8cb4984591ab475..2f70f9b3475623cac2b62be99923ea2ff6a470c7 100644
--- a/src/types/IChatterboxConfig.ts
+++ b/src/types/IChatterboxConfig.ts
@@ -17,6 +17,13 @@ export interface IChatterboxConfig {
     token: string;
     // URL of the image that should be used as the users avatar
     avatar: string;
+    // Configure this to enable Sentry (sentry.io) tracing.
+    sentry?: {
+        // The DSN URL where Sentry reports will be sent.
+        dsn: string;
+        // The environment to report to Sentry. E.g. "staging", "production"
+        environment: string;
+    }
 }
 
 interface IHeader {
diff --git a/yarn.lock b/yarn.lock
index 106a581f7aabf303f03fd00516f77ea8dc5df940..40cf37864024f70a24272523b03b0bed279fe21b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6,6 +6,58 @@
   version "3.2.3"
   resolved "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.3.tgz#cc332fdd25c08ef0e40f4d33fc3f822a0f98b6f4"
 
+"@sentry/browser@^7.5.0":
+  version "7.5.0"
+  resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.5.0.tgz#1ac651117625c732de58cfbd46dd9cf302212e42"
+  integrity sha512-tTtccbqYti8liTuLudTI0Qrgpe3sKajm0lwsMN4tb1YE879a9JiQ6U6kZ1G/fOIMjOm09pE7J8ozQ+FihPHw5g==
+  dependencies:
+    "@sentry/core" "7.5.0"
+    "@sentry/types" "7.5.0"
+    "@sentry/utils" "7.5.0"
+    tslib "^1.9.3"
+
+"@sentry/core@7.5.0":
+  version "7.5.0"
+  resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.5.0.tgz#4ccc2312017fc6158cc379f5828dc6bbe2cdf1f7"
+  integrity sha512-2KO2hVUki3WgvPlB0qj9+yea56CmsK2b1XtBSyAnqbs+JiXWgerF4qshVsH52kS/1h2B0CisyeIv64/WfuGvQQ==
+  dependencies:
+    "@sentry/hub" "7.5.0"
+    "@sentry/types" "7.5.0"
+    "@sentry/utils" "7.5.0"
+    tslib "^1.9.3"
+
+"@sentry/hub@7.5.0":
+  version "7.5.0"
+  resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-7.5.0.tgz#30801accb9475cc3f155802a3fefd218d66fbfda"
+  integrity sha512-R3jGEOtRtZaYCswSNs/7SmjOj/Pp8BhRyXk4q0a5GXghbuVAdzZvlJH0XnD/6jOJAF0iSXFuyGSLqVUmjkY9Ow==
+  dependencies:
+    "@sentry/types" "7.5.0"
+    "@sentry/utils" "7.5.0"
+    tslib "^1.9.3"
+
+"@sentry/tracing@^7.5.0":
+  version "7.5.0"
+  resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-7.5.0.tgz#ad6da27563246e9d754c36a2a3d398cfb979117e"
+  integrity sha512-tSVnCJNImsWms4tBhJ2Xr+HI1i9zKg4eZ0dImi93/H3sf5hmK9r2E11Xs/8rTxqpGWzB8axVi2tcmqmfqXKGTg==
+  dependencies:
+    "@sentry/hub" "7.5.0"
+    "@sentry/types" "7.5.0"
+    "@sentry/utils" "7.5.0"
+    tslib "^1.9.3"
+
+"@sentry/types@7.5.0":
+  version "7.5.0"
+  resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.5.0.tgz#610f14c1219ba461ca84a3c89e06de8c0cf357bc"
+  integrity sha512-VPQ/53mLo5N8NQUB4k6R2GQBWoW8otFyhhPnC75gYXeBTItVCzJAylVyWy8b+gGqGst+pQN3wb2dl9xhrd69YQ==
+
+"@sentry/utils@7.5.0":
+  version "7.5.0"
+  resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.5.0.tgz#64435ea094aa7d79d1dfe7586d2d5a2bff9e3839"
+  integrity sha512-DgHrkGgHplVMgMbU9hGBfGBV6LcOwNBrhHiVaFwo2NHiXnGwMkaILi5XTRjKm9Iu/m2choAFABA80HEtPKmjtA==
+  dependencies:
+    "@sentry/types" "7.5.0"
+    tslib "^1.9.3"
+
 another-json@^0.2.0:
   version "0.2.0"
   resolved "https://registry.yarnpkg.com/another-json/-/another-json-0.2.0.tgz#b5f4019c973b6dd5c6506a2d93469cb6d32aeedc"
@@ -244,6 +296,11 @@ supports-preserve-symlinks-flag@^1.0.0:
   resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
   integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
 
+tslib@^1.9.3:
+  version "1.14.1"
+  resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
+  integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
+
 typescript@^4.4.4:
   version "4.5.5"
   resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3"