Skip to main content

๐Ÿ“ˆ Install Plausible Analytics

Installing Plausible Analytics in Slate is easy if you take two necessary steps into account.

XSLT Attribute Requirement

The default installation code generated by Plausible looks like this:

<script defer data-domain="rwf.test.technolutions.net" src="https://plausible.io/js/script.file-downloads.outbound-links.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>

Because XHTML does not support attribute minimization, the above will throw an error, like 'data-domain' is an unexpected token. The expected token is '='. Line 12, position 23.

To fix this, simply supply a value for defer:

<script defer="defer" data-domain="rwf.test.technolutions.net" src="https://plausible.io/js/script.file-downloads.outbound-links.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>

Triggering Traffic

Plausible attempts to automatically visit your site and review whether you installed the tracking script correctly. However, your Slate instance will probably redirect the root of your site, like apply.school.edu, to a different page, like school.edu, which will not have Plausible correctly installed.

To bypass this, simply visit a page in your Slate instance, like apply.school.edu/apply, from a browser and IP that are not blocked in Plausible's "Shields" list. Once Plausible sees traffic recorded, it will consider the installation valid.