This PR is basically reverting https://github.com/matomo-org/matomo/pull/14360/files but having an option to basically still use that behaviour.
Once merged will need to document this behaviour.
The failing UI test https://builds-artifacts.matomo.org/matomo-org/matomo/4.x-dev/41350/UIIntegrationTest_widgetize_ecommercelog.png seems not related to this PR
@tsteur Thank you for your work :+1: Looks good in my opinion.
@peterbo could you maybe also have a quick look if that would work for you?
@tsteur Code looks good to me. I'll test it later today in production to make sure! :) Ty!