Loading the tracker via another Javascript file


I’m pretty noob here, and I’m trying to figure a few things out. So far, I don’t have any problem adding the tracker to one of my website using the <script> tag, but sometimes that’s not possible. For instance, when using pkgdown, I cannot override the HTML template, and I can only inject extra.css and extra.js. Now, I’m wondering if there is a way to use extra.js and load the Plausible script? I think I can technically just copy/paste the script, but I’m sure there are better way.

Does a simple import('https://plausible.io/js/plausible.js'); works?

PS. I technically can override the template and the theme, and just use <script> but it would be great if I don’t have to do this.


We don’t have any official way to do this unfortunately. If you can find a way that works for you, it is fine but the only official way is to just use our script.