You can opt-out of having your site activity available to Google Analytics by installing the Google Analytics opt-out browser add-on. The add-on prevents the Google Analytics JavaScript (gtag.js, analytics.js) that is running on websites from sharing information with Google Analytics about visit activity.
Using the Google Analytics opt-out browser add-on will not prevent site owners from using other tools to measure site analytics. It does not prevent data from being sent to the website itself or in other ways to web analytics services.