@tsteur opened this Issue on February 24th 2022 Member

We've just been debugging an issue for a few days with various forth and back why Form tracking wasn't working. We noticed the tracking code wasn't added to the regular JS tracking code. This can have various reasons like not writable JS tracking file etc. It turned out that the CustomJsTracker wasn't activated.

We already have a check that shows when the tracker file is not writable in https://github.com/matomo-org/matomo/blob/4.x-dev/plugins/CustomJsTracker/Diagnostic/TrackerJsCheck.php but it doesn't show anything when the plugin is not activated.

How can we notice such an issue sooner / easier without devs needing to troubleshoot?

Maybe the diagnostics plugin could add a system check and show some information that the tracker file won't be updated when this plugin is not active. This would be "for your information" only as it is only needed when any custom JS tracker file exists. Meaning it's not a warning or an error or something.

Or maybe we could simply create an FAQ how to troubleshoot the issue and getting users to check if the CustomJsTracker plugin is listed in the activated or deactivated plugin list. Although people might not find the FAQ.

Or something else :)

I'll put this into 4.10 as it's an issue when people try our plugins, and they think the plugin isn't working but in reality its just that the CustomJsTracker plugin is deactivated.

@sgiehl commented on April 4th 2022 Member

@tsteur Can't we use plugin dependencies for that? In plugin.json It is already possible to define something like

    "require": {
        "matomo": ">=4.0.0-b5,<5.0.0-b1",
        "CustomJsTracker": "*"
    },

But our dependency check only checks if the plugin is installed in a correct version. We currently do not check if the plugin is also activated.
This might be something we could change. It would make it impossible to activate the plugin and could be shown like a missing dependency at the moment:
image

But we maybe should also consider to introduce a new check when disabling a plugin. So Matomo warns that disabling plugin X will also disable plugin Y (and Z) due to the dependencies. Otherwise users might disable CustomJsTracker without knowing that other plugins will automatically be disabled as well.

Related code:

https://github.com/matomo-org/matomo/blob/3b00013819863472afe30cc04de49c4365c22d21/core/Plugin/Dependency.php#L36-L63

https://github.com/matomo-org/matomo/blob/3b00013819863472afe30cc04de49c4365c22d21/core/Plugin/Dependency.php#L171-L196

@tsteur commented on April 4th 2022 Member

@sgiehl the plugin shouldn't be required as we also support loading the tracker file independent of the regular tracking code. Especially when the JS tracker files aren't writable. And there's a risk that it would automatically disable other plugins which would make things only worse.

It's such a rare case, I would say all we need is a quick system check to show that the plugin is disabled

@sgiehl commented on April 5th 2022 Member

@tsteur Ok. But guess it only makes sense to check that if a plugin is installed that provides a tracker.min.js file. Otherwise the plugin wouldn't be needed. right?

@tsteur commented on April 5th 2022 Member

Sounds good if it's easy to do 👍

Powered by GitHub Issue Mirror