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

Implement an easy way to include custom analytics tracking javascript code #2827

Open
3 tasks done
giorgi3092 opened this issue Nov 29, 2024 · 0 comments
Open
3 tasks done
Labels
enhancement New feature or request

Comments

@giorgi3092
Copy link

Requirements

  • This is a feature request and not a bug report. Otherwise, please create a new bug report instead.
  • Please check to see if this request (or a similar one) already exists.
  • It's a single feature. Please don't request multiple features in one issue.

Describe the feature you'd like

There is LEMMY_UI_CUSTOM_HTML_HEADER to include a custom code into the head of a lemmy-ui instance, but if the javascript code to be loaded is from a different domain name, CSP directive prevents that code from executing.

For example, I have successfully included my custom Matomo tracking code which is hosted under a different domain name with the LEMMY_UI_CUSTOM_HTML_HEADER header but the CSP flags it and prevents the execution. You can verify this error by heading over to my instance https://forumrs.com/ and examining the console output yourself.

I will post a screenshot of the error here:
Screenshot 2024-11-28 165238

It is possible to bypass CSP directive entirely with LEMMY_UI_DISABLE_CSP, but it poses a security risk. I have not tried this but I am assuming with this option, code would execute.

Maybe solution to this would be to provide another environment variable what would indicate a list of domain names from which code execution would be enabled with security header but I would leave this up to the developers to decide how to achieve this. This is certainly a problem preventing me from tracking the website traffic.

@giorgi3092 giorgi3092 added the enhancement New feature or request label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant