There are multiple filter lists for this very thing. For uBlock Origin, open the dashboard and go to the Filter lists tab, then look in the Annoyances section. “Fanboy’s annoyance” and “EasyList Cookie” both cover blocking these things. Make sure cosmetic filters are enabled.