Problem/Motivation
I've been using this module for a while, and each time, I have to override it because every project requires different data in their gtag events, especially when dealing with commerce events.
I noticed that all the classes handling event functionalities are restricted from being overridden due to the use of the final attribute on these classes.
If you want to alter the event data (for example, adding coupons, an item category, a brand name, etc.), you have to define a custom event (and a custom subscriber) that reuses the google_tag code. Another solution is to directly patch the module to override the final class.
Until now, I didn't consider this a significant problem, but with a recent project, I had to make a considerable number of modifications to the commerce events and global events. Initially, I tried to manage these modifications with a custom patch, but I realized that this approach would be difficult to maintain in the long term.
I found a related issue that aligns with mine. It is somewhat similar...
Proposed Resolution
It would be beneficial to remove the final attribute from the subscriber and event classes to make this module more flexible for custom modifications. These changes would make it easier for developers to override google_tag.
I'm also writing this issue to gather more information about this code structure. While I understand the rationale behind using the final class attribute, it significantly limits the ability to enhance the module to meet custom needs.
Another completely different solution would be to enhance the admin interface and the configuration forms by adding more granular configuration options for each event’s data.
What do you think about this topic?