Websites ask for cookie consent to comply with privacy laws like the EU’s GDPR. These laws require sites to inform users about the use of cookies that track personal information or preferences, giving users the choice to accept or decline the use of such cookies for enhanced privacy protection.