I'm using DTM to listen for an event-based rule, named "My Custom Rule". The event type is "custom", as I'm using custom events to track actions from a 3rd party widget. This is my configuration below. It's fairly bland, and I have no conditions (yet). The custom event name is "my-widget-loaded".
Within my 3rd party widget, I trigger my custom event:
document.dispatchEvent(new CustomEvent('my-widget-loaded'));
In the console, I see:
SATELLITE: detected my-widget-loaded on #documentument
But it never fires my rule, I never see a message like:
SATELLITE: Rule "My Custom Rule" fired.
I have verified that I can create custom event handlers within the console and they fire just fine.
What can I do to make my rule fire? Why isn't it working?
DTM (and Launch) does not properly listen for custom events when using document
as the Element or Tag Selector. Use body
(and document.body.dispatchEvent
) instead.