Track both Show and Hide events

Hi, I’m using this to track how many times visitors open a collapsed section, however it’s tracking both show and hide events together.

How can I track show and hide events separately?

<a class="btn btn-light btn-collapse" data-toggle="collapse" href="#collapseExample" onclick="javascript:_paq.push(['trackEvent', 'Gallery', 'Info expand']);">Link</a>

The events are: // This event fires immediately when the show instance method is called. // This event is fired immediately when the hide method has been called.

Many thanks

See Enable touch events, tracking zoom-in events