Fire event at first event open after install

Where would I insert some code that I only wanted to run the first time the app is opened after installation?

For context, we are using Segment. There are two events (“Application Installed” and “Application Opened”) that should fire automatically when the Segment SDK is installed using, say, the Segment Analytics for iOS via Cocoapods, but isn’t happening with Expo. Looking for a workaround by manually tracking this event.

Is this in a standalone app or running in the Expo client? Session tracking may not work correctly in the Expo client, as noted here:

A workaround would be to set a flag in AsyncStorage when the app is first opened.