Jump to content

[deprecated] RockAnalytics - GDPR compliant Google Analytics alternative for ProcessWire


bernhard
 Share

Recommended Posts

 

RockAnalytics.svg

Integrate plausible analytics or umami into your ProcessWire backend

https://processwire.com/modules/rock-analytics/
https://github.com/baumrock/RockAnalytics

q7IIR5V.png

Quickstart:

  1. Install the module
  2. Setup plausible analytics (either self hosted or paid cloud)
  3. Copy the tracking code into your site's markup
  4. Copy the share URL to your module's config

hr.svg

Donations

img

???

hr.svg

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

hr.svg

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.

hr.svg

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".

68747470733a2f2f692e696d6775722e636f6d2f576a6b525531512e706e67

 

  • Like 15
Link to comment
Share on other sites

  • 2 weeks later...

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.

  • Like 2
Link to comment
Share on other sites

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

  • bernhard changed the title to RockAnalytics - GDPR compliant Google Analytics alternative for ProcessWire
  • 1 month later...

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

  • 6 months later...

@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

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

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

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

@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

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!

  • Like 1
Link to comment
Share on other sites

@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.

  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...

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...

  • Like 3
Link to comment
Share on other sites

  • bernhard changed the title to [deprecated] RockAnalytics - GDPR compliant Google Analytics alternative for ProcessWire

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...