You show a small banner on the page, with 3 options: accept, reject optional and configure. Configure explains each thing and lets the user opt in to specific things. It is quite simple really.
And if you only track necessary information, you do not need a banner at all