Skip to content

Commit 7e81b09

Browse files
authored
feat(analytics): add doc to configure medama web analytics (#172)
1 parent bc54d8e commit 7e81b09

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

docs/external_tracking.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SECURITY_HEADER_CSP_CONNECT_SRC=https://analytics.example.com/matomo.js
1515

1616
### Add custom JavaScript
1717

18-
Add the following to Settings > Custom JS
18+
Add the following to Settings > Advanced Customization
1919

2020
```javascript
2121
var _paq = window._paq = window._paq || [];
@@ -37,6 +37,30 @@ navigation.addEventListener("navigate", function (e) {
3737
});
3838
```
3939

40+
## Set up for Medama
41+
42+
> ⚠️ Make sure to use your actual domain
43+
44+
### Allow loading tracking script
45+
46+
Set the following env vars:
47+
48+
```ini
49+
SECURITY_HEADER_SCRIPT_SRC_ALLOW=https://analytics.example.com
50+
SECURITY_HEADER_CSP_CONNECT_SRC=https://analytics.example.com/script.js
51+
```
52+
53+
### Add custom JavaScript
54+
55+
Add the following to Settings > Advanced Customization
56+
57+
```javascript
58+
const script = document.createElement('script');
59+
script.setAttribute('defer', true);
60+
script.setAttribute('src', 'https://analytics.example.com/script.js');
61+
document.body.appendChild(script);
62+
```
63+
4064
## Set up for Google Analytics
4165

4266
> ⚠️ Make sure to replace <your-tracking-id> with the actual value
@@ -52,7 +76,7 @@ SECURITY_HEADER_CSP_CONNECT_SRC=https://www.googletagmanager.com/gtag/js?id=<you
5276

5377
### Add custom JavaScript
5478

55-
Add the following to Settings > Custom JS
79+
Add the following to Settings > Advanced Customization
5680

5781
```javascript
5882
(function () {
@@ -100,7 +124,7 @@ SECURITY_HEADER_CSP_CONNECT_SRC=https://umami.example.com/script.js
100124

101125
### Add custom JavaScript
102126

103-
Add the following to Settings > Custom JS
127+
Add the following to Settings > Advanced Customization
104128

105129
```javascript
106130
(function() {

0 commit comments

Comments
 (0)