I would think server side caching is the most relevant. I am basically trying to integrate the Snapchat Pixel in a smart and minimal way. Snapchat wants user email and phone number when they are logged in, and they want it on every page load. So I am using wp_localize_script to avoid AJAX-calls for every page load. I don’t know if that’s necessary to avoid or not?
I am looking through the official Facebook Pixel for WordPress plugin to find some hits as to how they do it. I see that they also print JavaScript to the page with my email and phone number. This JavaScript is not present in incognito, and I would assume that the values are different for different people.
I see they use wc_enqueue_js some places, but I haven’t quite been able to track how they deal with caching etc. I can’t see that they use any AJAX-calls to get that information.
So the question is really: How do I give a JavaScript-file or the browser dynamic sensitive info that should not be cached between users? And how to I do it in a resource sparing way?