counter.dev icon indicating copy to clipboard operation
counter.dev copied to clipboard

Tracking JavaScript not compatible with every browser - IE not tracked.

Open ihucos opened this issue 5 years ago • 5 comments

A user noted that his browser does not support URLSearchParams and that for some browses like IE and older browsers fetch is not supported.

Each of this features are independently from each others supported by ~95% percent of all browsers.[1] With IE not supporting these two features at all and therefore not being tracked.

Not tracking IE is of course undesirable since it could be interesting for users to know how many of it's users are using IE in order to better evaluate if supporting it is worth it. Additionally I know there are potential users where a considerable percentage of users could be IE - for example internal webpages for corporations or governments where most users have to use IE.

On the other hand, we have that one of the design decisions of SWA is to not have a separate javascript file that is included but instead the tracking javascript embedded into the source. This is done like this for security reasons and because it's cheaper and SWA is a free service that is privacy friendly.

Having the embedded inline script not use fetch and URLSearchParams may be possible, but would make it longer and more complex.

Weighting this, my current opinion is that having a shorter and more legible tracking code and the transparency with that is more valuable than supporting more browsers and track IE. With time this issue may become more and more irrelevant.

I am very open to other opinions, a discussion or a concrete suggestion how the tracking code could look like so more browsers are supported :-)

[1] https://caniuse.com/#search=fetch https://caniuse.com/#search=URLSearchParams

ihucos avatar Aug 25 '20 12:08 ihucos

If you care about this you can add documentation that the one that want to use IE can add polyfill. There is even free service that add polyfills anyone can include that with the tracking code. to support fetch and URLSearchParams. https://polyfill.io/v3/

If you want I can create polyfill for both APIs (implementations most likely already exists) that can be put into documentation if anyone want to support older browsers.

jcubic avatar Mar 08 '21 19:03 jcubic

This is minfied implementation for Polyfill I've found. but I didn't test it though.

counter.min.txt

the code is based on

  • https://github.com/jerrybendy/url-search-params-polyfill
  • https://github.com/developit/unfetch

Unfetch is some old version I had in my other project and url-search param is just minimum that make the constructor work, I hope.

2kB of data if someone would like. I can test on BrowserStack where I have access to Windows machine.

jcubic avatar Mar 08 '21 20:03 jcubic

Just an idea, you can create server script that serve this data like polyfil.io user will include this script that will give output only for IE.

jcubic avatar Mar 08 '21 20:03 jcubic

Thats a really cool idea. Did not think of it. I will leave it open until more people ask for this. Currently there is no real documentation where this could go in.

ihucos avatar Mar 08 '21 22:03 ihucos

Please add this!

hello-smile6 avatar Feb 28 '22 00:02 hello-smile6