Is there a best practice to implement an opt-out functionality for google a

Is there a best practice to implement an opt-out functionality for google analytics with this vaadin plugin? Since this is needed for GDPR (DSGVO) compliance.