Is there a problem in adding Adsense verification code via JavaScript?

by JohnDoea   Last Updated September 09, 2019 21:04 PM

I work with a certain CMS (MediaWiki) in which there is no direct control over the HTML (as there is in Drupal TWIG files for example);
Hence, in this case, I have to load my Adsense verification code via JavaScript.
The following code pattern works - I do see the verification in HTML source codes (the code for the adds themselves is added with PHP):

var templateLiteral = [`
    <script async src=""></script>
    (adsbygoogle = window.adsbygoogle || []).push({
        google_ad_client: "ca-pub-VALUE",
        enable_page_level_ads: true

var head = document.querySelector("head");
head.innerHTML = templateLiteral;

Should there be any (long term) problem in doing so?

Related Questions

HTML validation: is it worth it?

Updated January 28, 2018 23:04 PM

CSS best practices / coding style with media queries

Updated August 13, 2017 17:04 PM

Open Source website backup tool suggestions

Updated March 13, 2016 08:01 AM