simpleanalytics / scripts

Open Source Public Scripts for Simple Analytics
https://www.simpleanalytics.com
MIT License
92 stars 14 forks source link

Install via NPM #46

Open sandstrom opened 2 months ago

sandstrom commented 2 months ago

Would be nice with instructions on how to install this via NPM, to avoid having to make an HTTP request to pull the file for every page load (i.e. /latest.js).

This will also help with Adblockers, since the code is instead bundled inside the static HTML/CSS/JS for the website.

Is this possible today? And if so, maybe add some instructions in this repo or in your docs (I've tried to find it, but no luck, but maybe I'm blind 😄)

adriaandotcom commented 2 months ago

You mean server side?

sandstrom commented 2 months ago

Depends on what you mean by server-side, but I'm thinking of build-time for popular Single Page Applications (SPAs) such as React, Vue and Static Site Generators such as Astro, Hugo and Gatsby.

For all of them, being able to bundle the simple analytics code among all other JS code (instead of fetching it on every page load) would be a win.

adriaandotcom commented 2 months ago

Ah, I see. Bundling with the rest of the bundle. It's not on our roadmap, but always happy to accept pull requests.