diff --git a/aleksis/core/templates/core/base.html b/aleksis/core/templates/core/base.html
index 76825b16c5bbec33c1a4a6dc54944bed5bdea0ff..c7d07f2de69ee383a1f9b538344b6827961d33a7 100644
--- a/aleksis/core/templates/core/base.html
+++ b/aleksis/core/templates/core/base.html
@@ -37,11 +37,14 @@
 
   {% if SENTRY_ENABLED %}
     {% include_js "Sentry" %}
+    {{ SENTRY_SETTINGS|json_script:"sentry_settings" }}
     <script type="text/javascript">
+      const sentry_settings = JSON.parse(document.getElementById('sentry_settings').textContent);
+
       Sentry.init({
-        dsn: '{{ SENTRY_SETTINGS.dsn }}',
-        environment: '{{ SENTRY_SETTINGS.environment }}',
-        tracesSampleRate: {{ SENTRY_SETTINGS.traces_sample_rate }},
+        dsn: sentry_settings.dsn,
+        environment: sentry_settings.environment,
+        tracesSampleRate: sentry_settings.traces_sample_rate,
         integrations: [new Sentry.Integrations.BrowserTracing()]
       });
     </script>