-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Navigator.sendBeacon for sending data #16
Comments
Thanks for the suggestion! I wonder if anyone is already using Plausible with sendBeacon... it wouldn't be to difficult to prototype. We're discussing with @RobertJoonas that he might give it a go over winter. Let's see. Sendbeacon is definitely interesting for analytics. |
I haven't looked into the implementation of other OSS privacy-focused trackers, but using |
Heya This looks great (and would solve #12 if I understand correctly, which would be lovely) I wanted to say that these beacon requests may be blocked by default by uBlock but it turns out that's not the case anymore. They are filtered like all other requests and only behind-the-scenes ones are blocked (not sure if that would apply here). So instead I'll expand on the ad-block issues. Unfortunately, plausible scripts are blocked by default in uBlock through the EasyPrivacy list (it's kinda sad that you need to jump through hoops like that with privacy friendly tracking but nothing we can do about that). This can be avoided by using the npm package directly or hosting the script on a different domain under a different file-name. Tl;dr: I don't think |
@Joelius300 Thanks for this. What are behind-the-scene requests? |
It appears to be terminology by uBlock meaning the following.
I'm referring to this Wiki page but as it says, it's partly outdated. If you're using uBlock, you can open the logger and switch to the "tabless" tab. I've found that reddit.com and blick.ch which appear to send behind-the-scene xhr requests (those appear to be filtered like any other requests). I've not seen any behind-the-scene beacon requests and as mentioned here those would still be blanket blocked it seems (again, rather old reference but I've not found any evidence against it). |
Hi all! I'm one of the people who ran into issues with automatic outbound link tracking, and decided to do it manually with These flags would default to I'd be happy to contribute a PR for this (in about three weeks though, need to study for my high school graduation exams now 😆 ). Edit: I realized that maybe the flag would be better in the main |
I tried to add this in #45. However, I'm a bit unsure of which of these to do:
Currently I have the 2nd implemented, but the 1st is IMO better. I personally like people to have the right defaults and if they are (for instance, this is what I am trying to do) sending an event right when a certain outbound button is pressed, |
Agreed. Unless we find that beacon request have a negative impact for example with ad-blockers, I think the default should absolutely use beacons. |
Seems like uBlock Origin blocks all beacon requests 👎 |
The current implementation of the
plausible-tracker
uses the common XMLHttpRequest for submitting analytics data. Yet with advancements in browser engines, a more specialized submit-method is available via thenavigator
, calledsendBeacon
, purpose-build for analytics requests.MDN Documentation
Detailed Description
On platforms that support both a
navigator
as well thesendBeacon
function, it would make sense to adopt this API for submitting analytics-data by progressively enhancing the request-module of plausible-tracker. A short summary of the advantages compared toXMLHttpRequest
(taken from MDN):B/c the submit-event gets queue and reliably sent by browser, using
sendBeacon
should have a zero-impact on transmitting analytics data while also guaranteeing that the data gets sent, eventually.Using
navigator.sendBeach
would therefore ready plausible-tracker for best usage in modern browsers.Context
Benefits explained before.
Possible Implementation
As a first draft, a simple if/else check for compat should be sufficient to determine the correct submit-function to use.
The text was updated successfully, but these errors were encountered: