Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the CloseWatcher API to track native modal closes in GA [🟥 awaiting full support] #2269

Open
chrisblakley opened this issue Dec 5, 2023 · 1 comment
Labels
Frontend (Script) Related to the client-side JavaScript. Low Priority Not of great importance, and certainly not urgent. Plugin / Library / API For third-party resources such as WordPress plugins, external APIs, and other libraries.
Milestone

Comments

@chrisblakley
Copy link
Owner

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
});
@chrisblakley chrisblakley added Low Priority Not of great importance, and certainly not urgent. Plugin / Library / API For third-party resources such as WordPress plugins, external APIs, and other libraries. Frontend (Script) Related to the client-side JavaScript. labels Dec 5, 2023
@chrisblakley chrisblakley added this to the 12.0 Flame milestone Dec 5, 2023
@chrisblakley chrisblakley modified the milestones: 12.0 Flame, 13.0 Bubble May 1, 2024
@chrisblakley
Copy link
Owner Author

chrisblakley commented Oct 9, 2024

https://caniuse.com/mdn-api_closewatcher

Screenshot 2024-10-09 at 11 13 11 AM

Waiting for Safari and Firefox support, but would not be hard to add this inside of a conditional that gets removed when it is fully supported, so not necessarily needing to wait...

@chrisblakley chrisblakley changed the title Use the CloseWatcher API to track native modal closes in GA Use the CloseWatcher API to track native modal closes in GA [🟥 awaiting full support] Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frontend (Script) Related to the client-side JavaScript. Low Priority Not of great importance, and certainly not urgent. Plugin / Library / API For third-party resources such as WordPress plugins, external APIs, and other libraries.
Projects
None yet
Development

No branches or pull requests

1 participant