I am trying to implement GTM(google tag manager) with a community following this article.
The problem I am experiencing is that GTM cannot see the lightning web components that were loaded in the community page. To solve this I am firing CustomEvents which bubble up all the way up to GTM(being loaded in the markup header) and that is working fine.
However I couldn't find anything about CustomEvents and if Salesforce plans on controlling the way those propagate in the future.
EDIT
Providing some code as a reference:
HTML:
<div class="outter-wrapper"> <div onclick={chatClick}></div> </div> JS:
chatClick() { if (this.template.querySelectorAll('.outter-wrapper')[0]) { let chatEvent = new CustomEvent( 'chatEvent', { detail: { startChat: true }, bubbles: true, cancelable: true } ); this.template.querySelectorAll('.outter-wrapper')[0].dispatchEvent(chatEvent); } }