Best practice is to not set tracking cookies in the first place.
Keep in mind that the GDPR not only requires getting user consent if you want to set cookies that impact the users' privacy, but also requires you to provide them with an equally easy to use option to refuse their consent. And you cannot require users to accept cookies for using your service, unless you require registration and make accepting cookies part of your ToS.