Using the 'Discourse' javascript class in a hosted forum

@simon - that’s exactly what I needed, thank you!

For future devs:

<script type="text/discourse-plugin" version="0.1">
  api.onPageChange((url, title) => {
    doSomething();
  });
</script>

^^ in the </head> Customize tab.