Great question — answering as the UphillTech team:
You can let the first script in the template of your nuxt component to declare all the variables. Or modify some of them at the beginning of your mounted function in your component. The actual difficulty here is to load your ad asynchronously after the variables are ready. So I used https://github.com/krux/postscribe which you cannot import in your component as it's meant for the client. So what I did here was a client plugin injected function containing the postscribe call with the src script, which I finally called in mounted and my ads got loaded \o/
Full answer by Alexandre Du Lorier: https://stackoverflow.stackexchange.com/a/65768413 (CC BY-SA 4.0).
Need it done for your business? UphillTech.