Alternatively, you can hook onto the "OnShow" and "OnHide" handler of a frame.
For example, this will call whenever you open up a character screen (bags, skills, journal, etc.)
Code:
ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnShow", function()
end)
ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnHide", function()
end)
The "MainMenuCategoryBar" is the top menu bar when you open up a menu.
Use /zgoo mouse to find a specific frame if you don't want them all.