timlrx / pliny

Create content rich websites with ease - built on next.js, contentlayer and tailwindcss
MIT License
295 stars 42 forks source link

Brave Ad-Blocker Blocks Default Umami Analytics Script URL – Need Custom Host Support #184

Closed eierina closed 1 week ago

eierina commented 2 weeks ago

The default Umami script URL (https://analytics.umami.is/script.js, https://cloud.umami.is/script.js) is blocked by browsers with built-in ad-blockers, such as Brave. This prevents the Umami analytics script from loading and tracking analytics data.

To Reproduce

Steps to reproduce the behavior:

  1. Go to a site using the Pliny Umami component with the default src set to https://cloud.umami.is/script.js.
  2. Open the site in the Brave browser with the integrated ad-blocker enabled.
  3. Inspect the console/network tab to observe that the script fails to load.

Expected Behavior

The Umami script should load successfully, and analytics should be tracked even when using browsers with ad-blockers enabled.

System Info (if dev / build issue):

Browser Info (Brave:

Additional Context

To bypass ad-blockers, hosting the Umami script on a custom domain is a solution. However, specifying a custom data-host-url attribute is necessary for directing analytics data to the correct endpoint when the script is hosted on a different server. Additionally, the Umami component would benefit from handling other data-* attributes dynamically to support current and future Umami script configurations.

eierina commented 2 weeks ago

will submit PR in short