plausible / plausible-tracker

Frontend library to interact with Plausible Analytics
https://github.com/plausible/plausible-tracker
MIT License
214 stars 46 forks source link

hashMode:false is ignored in dashboard #42

Closed k9ordon closed 2 years ago

k9ordon commented 2 years ago

Versions

Describe the bug

Setting hashMode:false in the tracker options does not disable hash mode in plausible analytics. I still get hrefs containing "#" in the dashboard.

Expected behavior

hashMode:false discards the hash part of the URL in the plausible dashboard.

Steps to reproduce

Steps:

  1. setup plausible-tracker
  2. create a <a href="#1">1</a>
  3. click the link
  4. /#1 shows up in the dashboard

Your Environment

Additional context

The disabled hash param is sending a zero int value (Tracker Code). The analytics controller seems to handle this as true (Analytics Code).

I also tried this with script based tracking. Adding .hash the the script results in adding a h:1 param to the request. Without .hash the h-param is omitted (not set to 0 as in the tracker-version) and is working with the serverside condition.

RobertJoonas commented 2 years ago

Hi @k9ordon!

This change would make it work indeed. But I think it's intuitive, that 0 should represent a false value in this case. I've made a change in how this is interpreted in the Elixir app (see: https://github.com/plausible/analytics/pull/2082). So I don't think we need to merge this PR.

Sorry for the inconvenience!

k9ordon commented 2 years ago

Looks good 👍