Allow per-site tracking URL (separate from BASE_URL) #6126
-
|
Hi all! When hosting Plausible CE for multiple products, I use DNS aliases so each product gets its own tracking subdomain (e.g. The problem: the generated tracking script hardcodes Current workaround: add the BASE_URL origin to connect-src on every site, which leaks the relationship between products. Is there an existing way to handle this that I'm missing? If not, a suggestion would be to allow setting a per-site tracking URL (e.g. a "Site URL" field in site settings) that the generated script uses for its event endpoint instead of BASE_URL. Thanks for building Plausible CE: loving it so far! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
@andreasscherman Thanks for your kind words! The endpoint for the autogenerated tracking script is a configurable value. You can set the <!doctype html>
<html lang="en">
<head>
<!-- Privacy-friendly analytics by Plausible -->
<script async src="https://plausible.example.com/js/pa-....js"></script>
<script>
window.plausible = window.plausible || function () { (plausible.q = plausible.q || []).push(arguments) }, plausible.init = plausible.init || function (i) { plausible.o = i || {} };
plausible.init({ endpoint: "https://plausible.example.com/api/event" })
</script>
</head>
<body>
demo
</body>
</html>There's a few other options that you can set in the init. https://www.npmjs.com/package/@plausible-analytics/tracker#configuration-options. These will have higher priority than site-side configuration. |
Beta Was this translation helpful? Give feedback.
@andreasscherman Thanks for your kind words!
The endpoint for the autogenerated tracking script is a configurable value. You can set the
endpointinplausible.initcall, example below.There's a few other o…