Great question — answering as the UphillTech team:
I did this by connecting the website to Cloudflare, then served Google Analytics through Zaraz (available in free plan). After this, I set up a click listener for website links with rel=nofollow (a[rel="nofollow"] selector) for tracking affiliate link clicks in Google Analytics without additional software. Note: New Google Analytics (4) may require some experimentation to see clicks. Set up trigger in Zaraz (Action Name > Event Name = "Aff Click Track Property: href") for GA to create a new event and easily track clicks in Google Analytics.
Full answer by block: https://stackoverflow.stackexchange.com/a/75272289 (CC BY-SA 4.0).
Need it done for your business? UphillTech.