Cookie consent in matomo tag manager

Hi, is there a way to have similar the functionalities in https://forum.matomo.org/u/activate-account/ff111798c497ad6f32eb261b9af278f6 with matomo tag manager? In specific only allow cookies when the user accepts it