WordPress gtag.js with User ID tracking
I think you need to do a couple of things: Move your calls to get the user inside your function – PHP variables aren’t shared across scopes without using global, which is generally a bad idea because it pollutes the global scope Consolidate your JS Use escaping methods before outputting data With those in mind, … Read more