Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help / Question: Self-hosting count.js #776

Open
vivekragunathan opened this issue Nov 14, 2024 · 5 comments
Open

Help / Question: Self-hosting count.js #776

vivekragunathan opened this issue Nov 14, 2024 · 5 comments

Comments

@vivekragunathan
Copy link

I am trying to self-host count.js based on this documentation:
https://rms.goatcounter.com/help/countjs-host

... where it says

To host count.js somewhere else just copy it from https://gc.zgo.at/count.js and adjust the URL in data-goatcounter.

If i use the self-hosted (relative url) for the data-goatcounter, what would the src be in

<script data-goatcounter="/scripts/count.js"
          src="????"></script>
@jkseppan
Copy link

The src attribute is just the standard attribute that specifies the URL of the script to load, so you'd put the location of your copy of count.js there. The data-goatcounter attribute is where Goatcounter should send the pageview data.

@rudeyak
Copy link

rudeyak commented Dec 1, 2024

Along the same lines... is there support for self-hosting at something other than the root of a web host, i.e. at https://my.host.com/goatcounter/...? I have an nginx setup and I'm reverse-proxying the traffic to the goatcounter listener (which was passed -tls proxy on the command line) with some rewrites and I can see the requests for the counter flowing in debug mode. However, there are certain site assets (e.g. /pikaday.css) that get served up with an absolute URL by the server binary. Can that behavior be modified or configurable?

@rudeyak
Copy link

rudeyak commented Dec 2, 2024

Feels like there's a possible way to address this in serve.go, where domainStatic gets set... if that could safely have a URL and not just a hostname, that could open up the variable that gets expanded as {{.Static}} when those other links get generated?!

@jkseppan
Copy link

jkseppan commented Dec 2, 2024

There is -base-path introduced in f413299 which doesn't seem to be part of a released version yet.

@rudeyak
Copy link

rudeyak commented Dec 2, 2024

Ooooh! That works!! So well ♥️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants