%%
date:: [[2024-01-22]]
parent::
%%
# [[How to use Plausible analytics with Obsidian Publish]]
[[Plausible Analytics]] requires you to include a script in the `<head>` of your [[Static site generator|statically generated]] site so that they can track visits. [[Obsidian Publish]] is a generator and hosting provider, but they don't give you access to the head tag.
Instead, what you can do is add this script to a file called `publish.js` that is within your Obsidian vault:
```js
var plausibleSnippet = document.createElement('script'); plausibleSnippet.defer = true; plausibleSnippet.setAttribute('data-domain', 'yourdomain.com'); plausibleSnippet.src = 'https://plausible.io/js/plausible.js'; document.head.appendChild(plausibleSnippet);
```
[^obsidianforum]
Replace `yourdomain.com` with the URL you're hosting your notes on.
Re-publish your Obsidian Publish vault, including the new `publish.js` file.
Then, add the site to Plausible as usual.
[^obsidianforum]: User @phrsn on the Obsidian community forum. (2022). *Enable Plausible Analytics on an Obsidian Publish site.* Retrieved from: https://forum.obsidian.md/t/enable-plausible-analytics-on-an-obsidian-publish-site/34661