Send GoatCounter hits to stats.mykiwi.blog
Add the stats CNAME to GoatCounter in infra (DNS-only so GoatCounter can issue its own certificate) and point the count endpoint at it. count.js stays on gc.zgo.at: the custom domain serves an HTML page at /count.js, not the script.
ff80112 parent: bda94bb modified
blog/layouts/_default/baseof.html +1 -1 | @@ -344,7 +344,7 @@ | ||
| 344 | 344 | }); |
| 345 | 345 | })(); |
| 346 | 346 | </script> |
| 347 | - <script data-goatcounter="https://mykiwi.goatcounter.com/count" | |
| 347 | + <script data-goatcounter="https://stats.mykiwi.blog/count" | |
| 348 | 348 | async src="//gc.zgo.at/count.js"></script> |
| 349 | 349 | {{- /* count.js only sees the first full load; hx-boost navigations after |
| 350 | 350 | that never reload <head>, so each one is reported by hand. The initial |
| @@ -344,7 +344,7 @@ | |||
| 344 | }); | 344 | }); |
| 345 | })(); | 345 | })(); |
| 346 | </script> | 346 | </script> |
| 347 | - <script data-goatcounter="https://mykiwi.goatcounter.com/count" | 347 | + <script data-goatcounter="https://stats.mykiwi.blog/count" |
| 348 | async src="//gc.zgo.at/count.js"></script> | 348 | async src="//gc.zgo.at/count.js"></script> |
| 349 | {{- /* count.js only sees the first full load; hx-boost navigations after | 349 | {{- /* count.js only sees the first full load; hx-boost navigations after |
| 350 | that never reload <head>, so each one is reported by hand. The initial | 350 | that never reload <head>, so each one is reported by hand. The initial |
modified
infra/main.tf +11 -0 | @@ -61,6 +61,17 @@ resource "cloudflare_record" "www" { | ||
| 61 | 61 | proxied = true |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | +# stats.mykiwi.blog -> GoatCounter, so the analytics endpoint is first-party. | |
| 65 | +# Not proxied: GoatCounter terminates TLS itself and issues the certificate | |
| 66 | +# for this hostname, which it can't do from behind Cloudflare's edge. | |
| 67 | +resource "cloudflare_record" "stats" { | |
| 68 | + zone_id = data.cloudflare_zone.this.id | |
| 69 | + name = "stats" | |
| 70 | + type = "CNAME" | |
| 71 | + content = "mykiwi.goatcounter.com" | |
| 72 | + proxied = false | |
| 73 | +} | |
| 74 | + | |
| 64 | 75 | # Page Rules would also do this but its Edit permission only shows up in |
| 65 | 76 | # the API token builder for account Super Administrators - Single Redirects |
| 66 | 77 | # (this resource) works with a normal scoped token (Zone:Dynamic Redirect:Edit). |
| @@ -61,6 +61,17 @@ resource "cloudflare_record" "www" { | |||
| 61 | proxied = true | 61 | proxied = true |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | +# stats.mykiwi.blog -> GoatCounter, so the analytics endpoint is first-party. | ||
| 65 | +# Not proxied: GoatCounter terminates TLS itself and issues the certificate | ||
| 66 | +# for this hostname, which it can't do from behind Cloudflare's edge. | ||
| 67 | +resource "cloudflare_record" "stats" { | ||
| 68 | + zone_id = data.cloudflare_zone.this.id | ||
| 69 | + name = "stats" | ||
| 70 | + type = "CNAME" | ||
| 71 | + content = "mykiwi.goatcounter.com" | ||
| 72 | + proxied = false | ||
| 73 | +} | ||
| 74 | + | ||
| 64 | # Page Rules would also do this but its Edit permission only shows up in | 75 | # Page Rules would also do this but its Edit permission only shows up in |
| 65 | # the API token builder for account Super Administrators - Single Redirects | 76 | # the API token builder for account Super Administrators - Single Redirects |
| 66 | # (this resource) works with a normal scoped token (Zone:Dynamic Redirect:Edit). | 77 | # (this resource) works with a normal scoped token (Zone:Dynamic Redirect:Edit). |