Serve plausible.js from CDN #339
Replies: 11 comments
-
What would be good about this? 🙂 |
Beta Was this translation helpful? Give feedback.
-
@prcmt well you have some benefits. For example: It's served from a CDN, so you should have fast loading times for the script since is closer to the visitor; You're not overloading the main server with requests, since you're loading from outside the server. |
Beta Was this translation helpful? Give feedback.
-
I'd argue that CDNs are generally incompatable with user privacy. I don't think it would be right for a privacy conscious service like Plausible to make use of them. (And I'd argue that everyone should stop using them in general!) When you use a CDN, you're inserting an extra third party into the communication between you and your users. A third party that has the ability to inject JavaScript into your pages and is almost certainly slurping up end user data, like IP addresses and fingerprinting data points. Note that both CDNjs's and JSDelivr's privacy policies admit to collecting personal data from end users (although they try to pretend otherwise). David Revoy has an article that briefly goes over this danger. The benefits of using a CDN are not as obvious as they seem from a performance perspective either, athough that's a rather larger topic. In this particular case though, remember that Plausible's JavaScript snippet is only 1090 bytes. It's tiny. It's safe to assume that the added overhead of a DNS lookup, a new HTTP connection and TLS negotiation probably outweigh any benefits. See also, Please stop using CDNs for external JavaScript libraries. |
Beta Was this translation helpful? Give feedback.
-
@prcmt really good points there. Thank you! I totally understand your points, still you have a lot of websites using Vercel, Netlify and others, which are based on CDN's. So for users using that I don't see a problem for also using a CDN for this. However, if the community comes to the conclusion that is not viable then we can also make the use of preconnect for faster loading times due to SSL handshakes and so on. |
Beta Was this translation helpful? Give feedback.
-
Do you have reason to think that Plausible has an issue with performance? After all, it has no user facing components. So does it really matter how many milliseconds it takes to load? Especially as it's being |
Beta Was this translation helpful? Give feedback.
-
I was thinking in agencies that are using for multiple users with millions of users, a single file can make difference to a server. |
Beta Was this translation helpful? Give feedback.
-
@metmarkosaric You should be able to use cdnjs, since you have over 800 stars on GitHub. See the docs on adding a library. |
Beta Was this translation helpful? Give feedback.
-
Plausible is serving the file, not you. Think of them as your CDN. 😅 |
Beta Was this translation helpful? Give feedback.
-
I thought that for self-hosting it was the server sending the file, not Plausible. 🤔 Anyway, this is easily fixable using CF Workers with better loading times and avoiding handshakes. |
Beta Was this translation helpful? Give feedback.
-
Sorry! Yes, of course. I wasn't thinking about self-hosting. |
Beta Was this translation helpful? Give feedback.
-
This would a great feature addition if not implemented already. |
Beta Was this translation helpful? Give feedback.
-
Prerequisites
Feature request
Will be really nice to have the ability to serve
plausible.js
and other required scripts from a CDN. Count.ly already does this. You can use your domain or the CDN. There are two options available: using Cloudflare (CDNjs) or JSDelivr (both of which are highly available CDNs).How would you like it to work
Would be nice to have the option as Count.ly has, to use my domain or CDN.
https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-#setting-up-recommended-asynchronous-usage
Really thank you for the amazing work!
Beta Was this translation helpful? Give feedback.
All reactions