github.com/Jeffail/benthos/v3@v3.65.0/website/src/plugins/analytics/client.js (about) 1 function poke(host, path) { 2 // TODO: Allow this to be configured 3 fetch(`https://poke.benthos.dev/poke?h=${encodeURIComponent(host)}&p=${encodeURIComponent(path)}`, { method: "POST" }) 4 .catch((error) => console.error(error)) 5 } 6 7 module.exports = (() => { 8 if (typeof window !== "object") { 9 return {}; 10 } 11 12 const host = window.location.hostname; 13 let path = window.location.pathname; 14 15 poke(host, path); 16 return { 17 onRouteUpdate({location}) { 18 if ( path === location.pathname ) { 19 return; 20 } 21 path = location.pathname; 22 poke(host, path); 23 }, 24 }; 25 })();