How to track Bootstrap modal dialogs

I am testing Matomo on my website, which is a kind of gallery. All the interesting content, where the users go, is displayed in modal dialogs, I would like to track those openings.
Is it possible?
Currently, only the main page (showing widgets) appears in Matomo.


Simply call the event tracking JavaScript whenever the modal is opened:

As simple as that.
Thank you Lukas.