Sure, use whatever yields best results for you.
I am replying to the wide public here, not just you: the fact that JavaScript integration exposes a code snippet does not immediately make it worse than PHP integration. People tend to vastly overestimate bot capabilities when it comes to script analysis and memorizing: contemporary checker bots are smart, but not nearly smart enough to tell what a piece of JS code does at a glance. All they can do is collect a lot of statistical data to spot direct correlation between a code snippet and rate of cloaking bans; it takes a lot of time, and hundreds if not thousands of ad campaigns. If the code snippet in question is obfuscated and randomized, then this task becomes technically infeasible.
And it does matter since, as per our observations (and we have a lot of data), JS integration paired with JS fingerprinting performs much better than naïve PHP-based blacklisting on larger ad platforms like Google Ads and TikTok Ads.