Add Tinylytics script to Obsidian Publish
If you use Obsidian Publish and want to add Tinylytics tracking to your published site, you can do so with these steps.
- Set up your Tinylytics account.
- Create a file named publish.js in your root directory. Don’t create this file from inside Obsidian, but instead, directly in your file system.
- Add the following script to the publish.js file.
- Update the script with your embed code.
- Publish the file to Obsidian Publish.
- Test!
var tinylyticsScript = document.createElement('script');
tinylyticsScript.defer = true;
tinylyticsScript.src = 'https://tinylytics.app/embed/YOUREMBEDCODE.js';
document.head.appendChild(tinylyticsScript);