lando icon indicating copy to clipboard operation
lando copied to clipboard

Add Matomo recipe

Open cabagach opened this issue 4 years ago • 17 comments

It would be great to have Matomo available as a service, like we have with Redis and PhpMyAdmin.

Alternatively, is anyone using it in Lando already with another method?

cabagach avatar Dec 15 '21 13:12 cabagach

@cabagach probably the best way to get this going would be to install Matomo on either the LAMP or LEMP recipes.

It'd make sense to have a Matomo recipe to help people get started quickly with it...you could then network that to your other apps. This would probably simulate how most people have Matomo installed for their projects.

LMK if you have success getting Matomo going on a base LAMP or LEMP recipe!

reynoldsalec avatar Dec 15 '21 17:12 reynoldsalec

Thanks for the help @reynoldsalec, your suggestion worked perfectly! It was actually really easy to get Matomo working with the LAMP recipe:

wget https://builds.matomo.org/matomo.zip && unzip matomo.zip
cd matomo
lando init --source cwd --recipe lamp --webroot . --name matomo && lando start

Install in browser from https://matomo.lndo.site/

The only thing I had to change was "Database Server" from 127.0.0.1 to database and use lamp for database name, user and password. After adding the Matomo script in another Lando instance (and disabling uBlock Origin both places) stats started flying in.

It'd make sense to have a Matomo recipe to help people get started quickly with it...you could then network that to your other apps. This would probably simulate how most people have Matomo installed for their projects.

That could be something worth considering. The web site to track is defined during the installation, I suppose that could be defined in the recipe? Or would it fit better as a service than a recipe?

PS. I hate to bug, but perhaps you don't get alerts for Merge Requests? I have created two, perhaps I should create issues for them?

cabagach avatar Dec 16 '21 18:12 cabagach

Glad to hear @cabagach!

I think a recipe would make more sense; services tend to be single components that you build applications out of (databases, key/value stores, appservers, etc), whereas recipes tend to amalgamate services to give a template to run an application.

Matomo is a full-fledged application in-of-itself, so I think the best start state would be a recipe, particularly considering your experience installing it on LAMP.

RE: PRs, sorry about that, we haven't been paying a ton of attention to the thinktandem repos since we've basically spun down Tandem as an agency...I'm guessing we should move that project over to the lando org since it is useful. I'll ping @labboy0276 on it since he'll be better equipped to review.

Do you want to take a swing at making a Matomo recipe?

reynoldsalec avatar Dec 16 '21 21:12 reynoldsalec

Thanks for helping me differ between services and recipes @reynoldsalec. You're right that Matomo is a more of a full fledged stand-alone application, which happens to work hand-in-hand with other applications. I will try to make a Matomo recipe, wish me luck :-)

No problem with the PRs, I just wanted to check. I think https://github.com/thinktandem/drupal-contributions/ is a super useful tool, so it would be awesome if it was moved to the lando organization.

cabagach avatar Dec 18 '21 10:12 cabagach

@cabagach I am not familiar with Matomo, but can you use it with other applications like Drupal or WordPress?

labboy0276 avatar Dec 22 '21 17:12 labboy0276

@labboy0276 yeah, it's an open source Google Analytics replacement, so basically it's a centralized app that would receive tracking information for other sites.

reynoldsalec avatar Dec 22 '21 19:12 reynoldsalec

@reynoldsalec @cabagach then I think a service would be better (ie Redis). Recipes are more for whole encompassing systems like LAMP stacks, Drupal, etc. Recipes typically use other services in themselves.

labboy0276 avatar Dec 22 '21 20:12 labboy0276

@labboy0276 that is the case with Matomo; it's a PHP app that would use an appserver service, a database service, and possible a couple others depending on the setup. The fact that it needs multiple services and that people are likely to customize it with additional composer packages/their own code is why I suggested a recipe.

reynoldsalec avatar Dec 22 '21 21:12 reynoldsalec

Oh OK @reynoldsalec

labboy0276 avatar Dec 22 '21 21:12 labboy0276

I probably won't get around to creating a recipe, sorry @reynoldsalec. It's simply too easy to just add Matomo on top of the LEMP recipe :-) (see my comment above 16 Dec 2021)

cabagach avatar Jan 20 '22 12:01 cabagach

NP @cabagach , it was pretty easy to throw together so I made a draft version: https://github.com/reynoldsalec/matomo

I need to do some more testing on it before publishing, but should give people a head start if they want to use it in the future. Basically it's mostly good for the docs...it really is just the LAMP recipe plus a tooling command to access Matomo's console CLI.

reynoldsalec avatar Feb 23 '22 05:02 reynoldsalec

Talking it over with the team, I'm now doubting whether a recipe or service is the best route. I think the crux is whether people need to store changes to their Matomo application within version control (separate from their main application).

From a brief glance at the Matomo docs, it looks like there isn't much configuration/extension of Matomo. Users likely won't change the core of Matomo, they might buy some plugins and need to install those, but that seems the extent of customization.

reynoldsalec avatar Feb 23 '22 18:02 reynoldsalec

Maybe it's worth considering starting with a minimal solution, where the user can add Matomo as a service, but has to create the web site to be tracked themselves? Assuming the service can be configured to take care of setting "Database Server" from 127.0.0.1 to database and use lamp for database name, user and password, this could be enough?

services:
  myservice:
    type: matomo

Later, if there is demand, it can be extended with environment overrides (as in phpmyadmin) like this:

services:
  myservice:
    type: matomo
    overrides:
      environment:
        matomo_my_config_value: 1

For Matomo configuration options, see INI Configuration and the documentation in global.ini.php.

If it's possible, maybe even allow configuring a web site for tracking with something like this?

[...]
      environment:
        matomo_website_id: 1
        matomo_website_url: https://www.example.org
        matomo_website_name: 'Example Org'

gitressa avatar Feb 23 '22 18:02 gitressa

Thanks @gitressa, this is helpful, I don't have any Matomo experience.

Yeah, I think your thinking aligns with what John and Mike have been recommending to me, I think I'm more onboard with that for right now.

If I get a chance I'll take a stab. We're trying not to add any new services/recipes/etc. before Lando 4, but this has been a decent place for me to mess around with things :)

reynoldsalec avatar Feb 25 '22 18:02 reynoldsalec

Sounds good @reynoldsalec, I'll be on standby, and whenever a minimal Matomo service is ready, I'll be ready to test it!

Also, since it looks like the movement towards more privacy is gaining traction, you might even consider switching lando.dev to use Matomo at some point? See for example these two recent rulings (jan/feb 2022) in France and Austria:

It's dead easy to set up tracking for marketing campaigns such as newsletters and social media: https://matomo.org/docs/tracking-campaigns/

Feel free to drop me a line if you have any questions, I'll be glad to help.

gitressa avatar Feb 25 '22 19:02 gitressa

Thanks @gitressa, will do! I definitely would need to get into Matomo more....I'm so used to GA that it's hard to think of moving, but do love that there's an open source alternative that you can self host.

reynoldsalec avatar Mar 02 '22 19:03 reynoldsalec

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.

stale[bot] avatar May 22 '23 22:05 stale[bot]