Skip to content

Commit abaa570

Browse files
committed
Add documentation for path
1 parent 1b6d361 commit abaa570

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

docs/websites/website-tools.qmd

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,13 @@ To add Plausible Analytics to your Quarto website:
223223
2. In your Plausible dashboard, navigate to your site's settings.
224224
3. Go to the "Site Installation" section and click "Review Installation" to get your unique tracking snippet.
225225
4. Copy the complete script snippet provided by Plausible from your dashboard.
226-
5. Add it to your `_quarto.yml` configuration file under the `plausible-analytics` key:
226+
5. Add it to your `_quarto.yml` configuration file.
227227

228-
For example, it could look like this, where `pa-XXXXXX.js` would be your own custom script provided by Plausible:
228+
You can provide the Plausible snippet in two ways:
229+
230+
**Option 1: Inline snippet**
231+
232+
Paste the snippet directly in your `_quarto.yml` configuration file under the `plausible-analytics` key. Use the `|` character after the key to preserve line breaks in the snippet:
229233

230234
``` yaml
231235
website:
@@ -237,10 +241,20 @@ website:
237241
</script>
238242
```
239243

244+
**Option 2: File path**
245+
246+
Save the snippet to a file (e.g., `_plausible_snippet.html`) and provide the path:
247+
248+
``` yaml
249+
website:
250+
plausible-analytics:
251+
path: _plausible_snippet.html
252+
```
253+
240254
The script will automatically be included in the `<head>` of every page on your website. **Important:** Make sure to copy and paste the complete snippet exactly as provided by Plausible - the example above shows the typical structure, but your actual snippet will have a unique tracking code instead of `XXXXXX`.
241255

242256
::: {.callout-tip}
243-
The snippet from your Plausible dashboard may include multiple `<script>` tags and initialization code. Copy the entire snippet as-is - don't modify or simplify it.
257+
The snippet from your Plausible dashboard may include multiple `<script>` tags and initialization code. Copy the entire snippet as-is - don't modify or simplify it. Using the file path option can be useful if you want to keep the snippet separate from your configuration or if you need to update it frequently.
244258
:::
245259

246260
#### Optional Enhanced Measurements

0 commit comments

Comments
 (0)