Problem/Motivation
The Commerce integration is opinionated to where the item ids do not match ones we currently use for product feeds and legacy UA ecommerce tracking. We need to be able to alter the tag event data before it's sent to the DOM. There is no built-in method to override the data produced by the tag plugins.
Proposed resolution
Currently I have not found a way to do this without breaking API compatibility, or changing how the attachment hook / response subscriber collects events. See MR for potential new feature.
Remaining tasks
Decide on a path forward for alter events.
User interface changes
None.
API changes
None with MR, but it's dirty.
Data model changes
Attachment hook and response subscriber get a new method for collecting event data.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 3358305-17.patch | 7.09 KB | casey |
| #16 | 0001-Add-event-alter-functionality.patch | 7.93 KB | kazajhodo |
| #15 | 3358305-05.patch | 8.36 KB | kazajhodo |
| #8 | 3358305-04.patch | 8.34 KB | adebruin |
Issue fork google_tag-3358305
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
adebruin commentedThis patch takes the original patch and applies it to the latest release (2.0.2)
Comment #6
adebruin commentedThere was something missing in the previous patch. Here is the working one
Comment #7
adebruin commentedComment #8
adebruin commentedComment #12
rszrama commentedNot specifically sure the old module supported event level alteration, but it's a good idea and something I'm tagging to make sure we review / help push forward as part of that initiative.
Comment #13
rszrama commentedA less invasive solution may be proposed in #3410273: Allow to alter order item data for commerce events; cross-linking here.
Comment #14
berdirI didn't see this issue when I worked on mine. What I struggled with in my implementation was making the necessary context available to the event in a useful way. Many of the commerce plugins work in different ways, their context differs and the data they produce differs. My MR focuses on unifying that and having more specific events that work for many different events.
Comment #15
kazajhodo commentedUpdated patch for 2.0.5.
Comment #16
kazajhodo commentedUpdated patch for 2.0.6.
Comment #17
rob230 commentedThis is working nicely, and a much-needed feature.
Since there is no event name, you have to use the class name. Here's example usage:
In your EventSubscriber:
Comment #18
casey commentedReroll of patch #16 for D11 replacing Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher with Symfony\Component\EventDispatcher\EventDispatcher
https://www.drupal.org/node/3376090