Closed Schmedu closed 1 year ago
It already does that without passing the props
Hi @Schmedu! next-plausible
always gets the script remotely, either from plausible.io
or your custom domain, depending on how you set it up. At the moment it cannot use any script stored locally out of the box.
However if you create a nextjs api endpoint that returns the npm script, let's say (/api/script
) then you could theoretically overwrite the src prop as you're saying. But I am not sure that would work, because using the npm script requires an extra step of initializing the tracker and next-plausible
is designed to work with the hosted script that self initializes.
I will investigate and consider if it is worth supporting the npm script natively from next-plausible
, but I can't promise anything 😄 .
Thanks for the answer, @4lejandrito.
I thought that it might be possible to hook up the initialization of the script with next-plausible
s Context provider, where we are also provide the same information. With this approach you could skip the proxying of the script as it would be self hosted.
Would be nice if you could make it work. I'll close the issue in the meantime.
Hey @4lejandrito, first of all thanks for maintaining!
I have a question how to self host the script, because of SRI. I came across this here:
In another post I saw that the script is now posted to npm: https://github.com/plausible/analytics/discussions/1834
Is there a way that I can combine these two and just link to the script from the npm package with the
scriptProps
likeThanks in advance.