chrisblakley / Nebula

Nebula is a WordPress theme framework that focuses on enhancing development. The core features of Nebula make it a powerful tool for designing, developing, and analyzing WordPress websites consistently, yet its deliberately uncomplicated code syntax also serves as a learning resource for programmers themselves.
https://nebula.gearside.com
GNU General Public License v2.0
141 stars 36 forks source link

Use the CloseWatcher API to track native modal closes in GA #2269

Open chrisblakley opened 10 months ago

chrisblakley commented 10 months ago

CloseWatcher API documentation:

Here is an example of how to use it:

unnamed

Probably something like this:

const watcher = new CloseWatcher();
watcher.addEventListener('close', function(){
    //Send GA4 event here for element close
});