Expand my Community achievements bar.

SOLVED

DTM Custom Event Not Firing

Avatar

Level 1

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".

Screen Shot 2018-11-10 at 6.45.00 PM.png

Within my 3rd party widget, I trigger my custom event:

document.dispatchEvent(new CustomEvent('my-widget-loaded'));

In the console, I see:

SATELLITE: detected wtb-load on #documentument

But it never fires my rule, I never see a message like:

SATELLITE: Rule "My Custom Rule" fired.

What can I do to make my rule fire? Why isn't it working?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Try dispatching it on document.body

document.body.dispatchEvent(new CustomEvent('my-widget-loaded'));

Also, update your rule setting `Element Tag or Selector` to `body`



View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Try dispatching it on document.body

document.body.dispatchEvent(new CustomEvent('my-widget-loaded'));

Also, update your rule setting `Element Tag or Selector` to `body`