medama-io / medama

Self-hostable, privacy-focused website analytics.
https://oss.medama.io
385 stars 8 forks source link

Custom SPA tracking #133

Open mxrlkn opened 2 months ago

mxrlkn commented 2 months ago

Be able to include the script, but turn off any automatic tracking and get a way to do it manually. So I can do something like this:

<script defer src="https://HOST/script.js" notracking></script>
window.medama.track({
    url: "/example",
    event: {}
});
ayuhito commented 2 months ago

I'm not sure if attaching to window might be the best when dealing with ad-blockers.

Thoughts about an API like this instead?

<script defer src="https://HOST/script.js" manual></script>
<script>
  import * as medama from '@medama/browser';

  medama.track({...});
</script>

Related: #13

mxrlkn commented 2 months ago

Yeah that's much better.