The first step is to setup Google Analytics by adding your tracking ID / measurement ID.
Then, go to SEO, Analytics, Google Analytics tab, Events section.
To track external links, check “Enable external links tracking” option.
To track download files, check “Enable downloads tracking” option and enter the file extensions you want to track in Google Analytics to “Track downloads’ clicks” field.
Separate them with a pipe “|“, eg: docx|pdf|doc|txt
To track affiliate links, check “Enable affiliate/outbound links tracking” option and enter the keywords to follow.
Eg: if your affiliate link is https://example.com/aff/my-affiliate-link and you want to track it, enter “aff” to the field “Track affiliate/outbound links“.
You can add multiple keywords by separating them with a pipe “|“.
Save changes.
Clear your cache if necessary.

Then go to Google Analytics website.
Open your website property, and go to Reports, Engagement, Events page.
It might be necessary to manually setup the reporting by following this guide.