add the listener in the callback:
handler = Gmaps.build('Google');
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
markers = handler.addMarkers(<%=raw @hash.to_json %>);
handler.map.centerOn({ lat: 51.5008, lng: 0.1247 }) //center on Big ben
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
google.maps.event.addListener(handler.getMap(), 'click', yourFunction)
});