File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,38 @@ navigation.addEventListener("navigate", function (e) {
8585 trackPageView ()
8686});
8787```
88+ ## Set up for Umami Analytics
89+
90+ > ⚠️ Make sure to use your actual values for DOMAIN SCRIPT URL and <WEBSITE_ID>
91+
92+ ### Allow loading tracking script
93+
94+ Set the following env vars:
95+
96+ ``` ini
97+ SECURITY_HEADER_SCRIPT_SRC_ALLOW =https://umami.example.com/script.js
98+ SECURITY_HEADER_CSP_CONNECT_SRC =https://umami.example.com/script.js
99+ ```
100+
101+ ### Add custom JavaScript
102+
103+ Add the following to Settings > Custom JS
104+
105+ ``` javascript
106+ (function () {
107+ var d = document , s = d .createElement (' script' ), g = d .getElementsByTagName (' script' )[0 ];
108+ s .defer = true ;
109+ s .src = ' https://umami.example.com/script.js' ;
110+ s .setAttribute (' data-website-id' , ' <WEBSITE_ID>' );
111+ g .parentNode .insertBefore (s, g);
112+ })();
113+
114+ navigation .addEventListener (" navigate" , function (e ) {
115+ if (window .umami && typeof umami .trackView === ' function' ) {
116+ umami .trackView (document .title , window .location .pathname );
117+ }
118+ });
119+ ```
88120
89121## Other tools / custom tracking
90122
You can’t perform that action at this time.
0 commit comments