Hi,
In this line the photoswipe object gets created and assigned to the variable gallery
.
So you can put the event listeners in the following line:
gallery.listen('initialZoom', function() {
_paq.push(['trackEvent', 'Gallery', 'Interaction', 'Open']); // you can set category, action and name however you want
});
gallery.listen('initialZoomOut', function() {
_paq.push(['trackEvent', 'Gallery', 'Interaction', 'Close']); // you can set category, action and name however you want
});
Your solution from “Track both Show and Hide events” doesn’t track photoswipe interaction, but just when a user clicks on the link.