In order for Google Analytics to be legal, users must consent to the use of any cookies or trackers that collect their personal data by agreeing to a privacy policy.