Skip to content
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

Remove Electron early return #156

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Remove Electron early return #156

wants to merge 1 commit into from

Conversation

benvinegar
Copy link
Owner

I don't know of a good reason to have this. Out of mild curious, I checked the Plausible tracker source code and saw no comparable clause.

Fixes #152

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.25%. Comparing base (c41f388) to head (f0e5414).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #156   +/-   ##
=======================================
  Coverage   87.25%   87.25%           
=======================================
  Files          38       38           
  Lines        2432     2432           
  Branches      302      302           
=======================================
  Hits         2122     2122           
  Misses        302      302           
  Partials        8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Halyul
Copy link

Halyul commented Feb 4, 2025

hmm, I might expressed my issue unclearly. Actually, I want to track file:// urls where location.host is empty. I know it is possible to use canonical url link to bypass it, but I wanna know if an option can be provided to bypass the check like

if (typeof opts.trackAll === "undefined" && location.host === "" && navigator.userAgent.indexOf("Electron") < 0) {
  return;
}

So when I can simply invoke Counterscale.trackPageview({ trackAll: true }); to track file:// urls

@benvinegar
Copy link
Owner Author

benvinegar commented Feb 5, 2025

@Halyul Thanks for the clarification. I kind of prefer allowFileURIs – and it could be set during initialization. So:

Counterscale.init({
  siteId: "example",
  reporterUrl: "...",
  allowFileURIs: true
});

Counterscale.trackPageview();

That work?

@Halyul
Copy link

Halyul commented Feb 5, 2025

surely yes. thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to bypass Electron and empty host check
2 participants