If you use Obsidian Publish and want to add Tinylytics tracking to your published site, you can do so with these steps.

  1. Set up your Tinylytics account.
  2. 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.
  3. Add the following script to the publish.js file.
  4. Update the script with your embed code.
  5. Publish the file to Obsidian Publish.
  6. Test!
var tinylyticsScript = document.createElement('script');
tinylyticsScript.defer = true;
tinylyticsScript.src = 'https://tinylytics.app/embed/YOUREMBEDCODE.js';
document.head.appendChild(tinylyticsScript);