Option to bypass Electron and empty host check
Hi, I have a very special case where I want to track file:// urls. As there is a check in trackPageview, I would like to know if an option to bypass the check can be added in the future.
Yep, I think we can figure this out.
@Halyul Looked at this and thought it best just to remove the check entirely. Thoughts on #156?
@Halyul Sorry for the slow reply on this – I wanted to break out Electron and verify the behavior myself.
I put together a "Hello, World" Electron app with a minimal HTML file, loaded up tracker.js, and it seems ... to work?
I don't think I read this code correctly, initially:
if (r.host === "" && navigator.userAgent.indexOf("Electron") < 0)
return;
If host is an empty string, and the user agent includes Electron, it allows the pageview request to go forward (it only returns if "Electron" is not present). Basically this is a carve out to ensure host-less pageviews are allowed as long as it's an Electron environment.
If you're seeing differently, could you provide a repro case?
If host is an empty string, and the user agent includes Electron, it allows the pageview request to go forward (it only returns if "Electron" is not present). Basically this is a carve out to ensure host-less pageviews are allowed as long as it's an Electron environment.
I believe this is the case. My case is that I wanna track file:// urls opened in chrome, which is empty host and not Electron, causing return at this line. So I make this request to provide an option to bypass this
Ah, oops, I'd totally misunderstood this ticket from the very beginning. I'd presumed the Electron code was blocking your Electron app. Got it now.
Testing comment retrieval