Is there a way to set up a listener function to listen to events?

You can easily listen to Journeys lifecycle events by registering listener functions like so:

javascript var listener = function(event, data) { console.log(event, data); } // Specify an event to listen for branch.addListener('willShowJourney', listener); // Listen for all events branch.addListener(listener);

Listener Name

Description

willShowJourney

Journey is about to be shown

didShowJourney

Journey's entrance animation has completed and it is being shown to the user

willNotShowJourney

Journey will not be shown and no other events will be emitted

didClickJourneyCTA

User clicked on Journey's CTA button

didClickJourneyClose

User clicked on Journey's close button

willCloseJourney

Journey close animation has started

didCloseJourney

Journey's close animation has completed and it is no longer visible to the user