Built-in analytics for plugins

Hi! We are thinking of getting analytics of our plugins (Server and Cloud) usage and apps crashes from our customers, and would like to add built-in analytics to plugins code. I understand to there may be restrictions due to GDPR policy, but is there any ways to do it officially, with customers agreement for example?
Where can I find official information on that? And are there any recommendations on third party systems usage (like sentry, firebase and so on)? Basically the issue is that we want to understand which features of our plugins are used the most, which buttons customers click on and so on. And also to see if there are any errors returned by our plugins.

I will really appreciate if anyone can share their experience and knowledge on this topic!

I’m talking about cloud and server apps both.

Thank you in advance!