bernhard Posted July 8, 2022 Share Posted July 8, 2022 Integrate plausible analytics or umami into your ProcessWire backend https://processwire.com/modules/rock-analytics/ https://github.com/baumrock/RockAnalytics Quickstart: Install the module Setup plausible analytics (either self hosted or paid cloud) Copy the tracking code into your site's markup Copy the share URL to your module's config Donations ??? About plausible analytics Plausible is a "simple and privacy-friendly Google Analytics alternative". It is open source and you can either self host it or buy one of their hosted services. A live demo of their dashboard and its features can be found here: https://plausible.io/plausible.io Tracking Snippet When you add a website to your plausible dashboard it will show you a tracking code that you can paste into your site that you want to track. This is what I use to make sure that we only track users on the live site (not on local development) and only logged in users: if(!$user->isLoggedin()) { $src = "https://plausible.verdino.com/js/plausible.js"; echo "<script defer data-domain='{$config->httpHost}' src='$src'></script>"; } Providing a dynamic domain is handy because during development you can add a second website to your dashboard and see if everything works without messing up data of your live site account. Example: We want to track the site "example.com", so we add this site to our plausible dashboard. Then we add the snippet with the dynamic domain attribute. On local development we have the host "example.com.ddev.site" so all visits will not show up in the plausible dashboard for example.com; Now we add another website to plausible with the domain "example.com.ddev.site" and voila - we will see our dev-websites' visitors in realtime. Backend Menu Item By default RockAnalytics will create a menu item at the top level of your backend menu, but you can move that page to any place you like. For example you could move the analytics page under the "setup" page at the top of the screenshot. You can also rename the page if you don't like the label "Analytics". 15 Link to comment Share on other sites More sharing options...
wbmnfktr Posted July 16, 2022 Share Posted July 16, 2022 Does work with the umami share code as well. NICE! 1 Link to comment Share on other sites More sharing options...
bernhard Posted July 17, 2022 Author Share Posted July 17, 2022 Nice to know, thx! Does the iframe height fit as well? Both tools are very similar. When doing my research I had the feeling that plausible is a little more mature and has some more features (like password protecting the share screen). Maybe the module will get some updates in the future that use the API (for example showing the page view count in the page tree like PageHitCounter does). That would need different implementations for plausible and umami, so it's good to think about maybe supporting both upfront. 2 Link to comment Share on other sites More sharing options...
wbmnfktr Posted July 17, 2022 Share Posted July 17, 2022 The iframe fits very well. As if it was made for umami. They are indeed very similar. I prefer umami as I can host it super easy on either Vercel or Netlify, while using my own database. Another thing I really like is, that I can customize the script name to whatever I want - so blocking extensions won't catch it. Maybe plausible offers the same but as said before... hosting and setup was super easy. You can even get a testdrive up and running via railway.app within minutes. Link to comment Share on other sites More sharing options...
bernhard Posted October 4, 2022 Author Share Posted October 4, 2022 The latest version adds a Textformatter and some JS magic to easily add a (multilingual) opt-out-link to your privacy page (which is a GDPR requirement even though you are allowed to track without consent by default). Add this to your text: [rockanalytics-opt-out] And make sure to update your tracking code snippet: // in your main markup file echo $modules->get('RockAnalytics')->render([ 'domain' => $config->httpHost, // see description on next section 'src' => 'https://plausible.yourdomain.com/js/plausible.js', 'onlyGuests' => true, // only load script for guest users ]); See the docs here: https://github.com/baumrock/RockAnalytics Link to comment Share on other sites More sharing options...
bernhard Posted April 23, 2023 Author Share Posted April 23, 2023 @wbmnfktr I wanted to try umami and set it up on my server, but when I try to display the shared dashboard in the iframe I get this: fused to frame 'https://...' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'". Google brought no helpful result. Do you have an idea? Link to comment Share on other sites More sharing options...
artfulrobot Posted April 23, 2023 Share Posted April 23, 2023 Looks great @bernhard! I use plausible at the mo, but have just discovered umami's existence. It looks like it lacks features compared to plausible, and I'd hate to run a node server (paranoid of dependency/security hell). I'm considering running plausible myself (you can self host it too) as a trial. FWIW I proxy my plausible js/ajax requests through my server, to prevent being snared by blockers. Link to comment Share on other sites More sharing options...
bernhard Posted April 23, 2023 Author Share Posted April 23, 2023 8 minutes ago, artfulrobot said: It looks like it lacks features compared to plausible Which ones? I've found that for example in umami you can add users whereas in plausible you only have one? Also backing up the umami container eats up 4GB of data on my vps and I have no idea why at all it would need so much space for just a few statistics... umami seems to be very more lightweight. Link to comment Share on other sites More sharing options...
wbmnfktr Posted April 23, 2023 Share Posted April 23, 2023 6 hours ago, bernhard said: but when I try to display the shared dashboard in the iframe Did you enable that feature?https://umami.is/docs/enable-share-url If so... I'm not sure what the issue could be. Are all SSL certificates valid and is everything publicly available? 1 hour ago, artfulrobot said: and I'd hate to run a node server Give Railway a try.https://umami.is/docs/running-on-railway Link to comment Share on other sites More sharing options...
bernhard Posted April 23, 2023 Author Share Posted April 23, 2023 1 minute ago, wbmnfktr said: Did you enable that feature?https://umami.is/docs/enable-share-url Sure, that's the url that I put in RockAnalytics config. The dashboard works standalone but not within the RockAnalytics Iframe... Link to comment Share on other sites More sharing options...
netcarver Posted April 23, 2023 Share Posted April 23, 2023 @bernhard Not sure if this will do it but,... If the source of the Umami CSP rule is in code you are self-hosting then it sounds like you need to edit the CSP settings to expand the frame-ancestors option from 'self' to include the domain hosting the iframe. Looking at the Umami demo site here, it looks like the CSP is being served as a header - so I suggest you take a look in the .htaccess file for the Content-Security-Policy header and expand the frame-ancestor part to include your hosting domain straight after the 'self' part. Header set Content-Security-Policy "...; frame-ancestors 'self' yourdomain.com; ..." If you aren't self hosting then you won't be able to alter the policy. Link to comment Share on other sites More sharing options...
bernhard Posted April 24, 2023 Author Share Posted April 24, 2023 Thx @netcarver yeah I'm selfhosting, but I was wondering why it worked for @wbmnfktr and not for me. I thought I might be missing a setting somewhere. But maybe the added this in an update ? I'll have a look... Link to comment Share on other sites More sharing options...
artfulrobot Posted April 24, 2023 Share Posted April 24, 2023 21 hours ago, bernhard said: Which ones? I've found that for example in umami you can add users whereas in plausible you only have one? Also backing up the umami container eats up 4GB of data on my vps and I have no idea why at all it would need so much space for just a few statistics... umami seems to be very more lightweight. I had been going on a quick search result which is probably not accurate; but it said that umami did not handle events or reports (emails). I see from umami.is that it does do events, though the 4 digit precision for numerical event data is pretty strange (unless they meant 4 decimal places). Sadly neither of them accept amount/e-commerce type data - which would be summed, not counted in charts (plausible issue) Statistics can grow and the more indexed they are the more they grow. It would be interesting to run both on the same site for a comparison! 1 Link to comment Share on other sites More sharing options...
wbmnfktr Posted April 24, 2023 Share Posted April 24, 2023 @bernhard so... I just installed a new instance of Umami on Railway and local, yet the newest version doesn't work with your module anymore - for now. The same issue. I found something in regards to server headers, yet... those didn't fix that issue. Might look into it the next days I find time for it. 1 Link to comment Share on other sites More sharing options...
bernhard Posted April 25, 2023 Author Share Posted April 25, 2023 Thx @wbmnfktr turns out there is an issue already: https://github.com/umami-software/umami/issues/1802 Please give it a thumbs up! Link to comment Share on other sites More sharing options...
eydun Posted July 12, 2023 Share Posted July 12, 2023 This was solved by Umami’s major release today. 1 Link to comment Share on other sites More sharing options...
eydun Posted July 13, 2023 Share Posted July 13, 2023 Then again, I am not so sure... This is the supposed solution: https://github.com/umami-software/umami/pull/2090 Link to comment Share on other sites More sharing options...
bernhard Posted July 14, 2023 Author Share Posted July 14, 2023 I'm using Matomo now, because it was too much hassle for me to host plausible myself. I hosted it as docker app which was quite simple (only challenge being the reverse proxy setup), but the backup part was a pain. No instructions, no help, so I decided to take the short path and just add a cronjob that shuts down docker and then copies all files to a directory that get's then backed up every night from my server control panel. That was not ideal at all and the docker backup took over 30GB of data within a very short period of time on a tiny site, meaning just hosting plausible ate 70GB of my server ? So I decided to give Matomo another try and as it uses PHP+MySQL it fits perfectly with my server panel and all backups run without any configuration every night smoothly and efficiently. DB size is 2,5MB at the moment ? And you get a lot more insights with Matomo and have a lot more options. Though the dashboard is by far not so pretty... 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now