@@ -108,6 +108,11 @@ <h1>External tracking with Matomo,<br>Google Analytics & Co</h1>
108108< li > < a href ="#add-custom-javascript_1 "> Add custom JavaScript</ a > </ li >
109109</ ul >
110110</ li >
111+ < li > < a href ="#set-up-for-umami-analytics "> Set up for Umami Analytics</ a > < ul >
112+ < li > < a href ="#allow-loading-tracking-script_2 "> Allow loading tracking script</ a > </ li >
113+ < li > < a href ="#add-custom-javascript_2 "> Add custom JavaScript</ a > </ li >
114+ </ ul >
115+ </ li >
111116< li > < a href ="#other-tools-custom-tracking "> Other tools / custom tracking</ a > < ul >
112117< li > < a href ="#configuration-adjustments "> Configuration adjustments</ a > </ li >
113118< li > < a href ="#track-view-changes "> Track view changes</ a > </ li >
@@ -187,6 +192,31 @@ <h3 id="add-custom-javascript_1"><a class="toclink" href="#add-custom-javascript
187192 trackPageView()
188193});
189194</ code > </ pre >
195+ < h2 id ="set-up-for-umami-analytics "> < a class ="toclink " href ="#set-up-for-umami-analytics "> Set up for Umami Analytics</ a > </ h2 >
196+ < blockquote >
197+ < p > ⚠️ Make sure to use your actual values for DOMAIN SCRIPT URL and < WEBSITE _ID > </ p >
198+ </ blockquote >
199+ < h3 id ="allow-loading-tracking-script_2 "> < a class ="toclink " href ="#allow-loading-tracking-script_2 "> Allow loading tracking script</ a > </ h3 >
200+ < p > Set the following env vars:</ p >
201+ < pre > < code class ="language-ini "> SECURITY_HEADER_SCRIPT_SRC_ALLOW=https://umami.example.com/script.js
202+ SECURITY_HEADER_CSP_CONNECT_SRC=https://umami.example.com/script.js
203+ </ code > </ pre >
204+ < h3 id ="add-custom-javascript_2 "> < a class ="toclink " href ="#add-custom-javascript_2 "> Add custom JavaScript</ a > </ h3 >
205+ < p > Add the following to Settings > Custom JS</ p >
206+ < pre > < code class ="language-javascript "> (function() {
207+ var d = document, s = d.createElement('script'), g = d.getElementsByTagName('script')[0];
208+ s.defer = true;
209+ s.src = 'https://umami.example.com/script.js';
210+ s.setAttribute('data-website-id', '<WEBSITE_ID>');
211+ g.parentNode.insertBefore(s, g);
212+ })();
213+
214+ navigation.addEventListener("navigate", function (e) {
215+ if (window.umami && typeof umami.trackView === 'function') {
216+ umami.trackView(document.title, window.location.pathname);
217+ }
218+ });
219+ </ code > </ pre >
190220< h2 id ="other-tools-custom-tracking "> < a class ="toclink " href ="#other-tools-custom-tracking "> Other tools / custom tracking</ a > </ h2 >
191221< h3 id ="configuration-adjustments "> < a class ="toclink " href ="#configuration-adjustments "> Configuration adjustments</ a > </ h3 >
192222< p > To make the frontend load the tracking script you need to change two environment variables:</ p >
0 commit comments