DTM Examples- Event-Based Rules Troubleshooting

If DTM is able to listen to a user action, you should see a "SATELLITE: detected click on _____" in the DTM debugging notes. For example, click on the following and see what you see in your console:


However, sometimes developers have hijacked the default behavior of a user action, making it so DTM can't listen. See what happens when you click this link:

This is an example link that's been hijacked.

Your click showed this new content. Click here to go back

For those links, you won't see "SATELLITE: detected click on A" because I used "return false" on the link to prevent it from doing the default link behavior of taking you to a new page. Another common culprit of this is "preventDefault". My event-based rule, which should match "a.doThisInstead", isn't firing- even though I KNOW my CSS selector is correct: I can use either of these snippets in my console to confirm:

jQuery("div.withoutBubbling a.doThisInstead") //if you have jQuery and prefer it
document.querySelectorAll("div.withoutBubbling a.doThisInstead") //if you don't have jQuery

To work around this problem, I can tell DTM to listen directly to the element, rather than trying to catch the click by casting a page-wide net. See how that rule works below:

This is an example link that's been hijacked.

Your click showed this new content. Click here to go back