I'm looking to integrate GoatCounter's tracking pixel: https://www.goatcounter.com/help/pixel
Per their docs, this looks like:
<img src="https://MYCODE.goatcounter.com/count?p=/url-goes-here">
I'd like to be able to use Blot's existing templating logic to do something like:
<img src="https://MYCODE.goatcounter.com/count?p=/{{req.url.path}}">
I don't believe there is a global variable which you can use to achieve something approaching {{req.url.path}}
.
Could you use JS instead append the image to the footer of each page? Adding something like this to script.js
should do the trick:
document.body.innerHTML +=
`<img src="https://MYCODE.goatcounter.com/count?p=${window.location.path}">`
Answered 3 months ago ·
Improve this answer