> and it may not be legal given consent/opt-out requirements.
It would be a remarkably narrow law that made it illegal to do something client-side but not server-side. AFAIK it's usually about what data you collect and how you use it, not precise details about how it was collected and stored along the way.