• Resolved megalytic

    (@megalytic)


    How can I do something like this? I don’t see any to asynchronously load a JS library. I must be missing something …

    <!– Global site tag (gtag.js) – Google AdWords: 999999999 –>
    <script async src=”https://www.googletagmanager.com/gtag/js?id=AW-999999999″></script&gt;
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());

    gtag(‘config’, ‘AW-999999999’);
    </script>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author SilkyPress

    (@diana_burduja)

    You can put the whole thing in the editor on the “Add Custom HTML” page. Like this.

    Thread Starter megalytic

    (@megalytic)

    Thanks, but I actually would like to use JS, not HTML. Using HTML tags with this plugin seems to break my site. The HTML code “bleeds” onto the top of my website pages. It just doesn’t work. Has anyone else had that kind of problem? See video: https://www.screencast.com/t/aaWzdho2NI

    Plugin Author SilkyPress

    (@diana_burduja)

    You can also put the whole thing in the editor on the “Add Custom JS” page, like this.

    As about the “bleeding” problem. It looks like there is a code somewhere on your website (most probably from a plugin) that automatically changes the content after a post is saved. (The Custom Code is internally a coded as a custom post type and it is subject to any modifications a normal post is.)

    After you copy/pasted the code and saved it, the
    <script async src="https://www.googletagmanager.com/gtag/js?id=AW-999999999"></script> changed to <a href="https://www.googletagmanager.com/gtag/js?id=AW-999999999">https://www.googletagmanager.com/gtag/js?id=AW-999999999</a> and the <script> tags were removed. This lead to the “bleeding” on the frontend.

    You can test the same Google Tag code on a freshly installed WordPress site and you’ll see that this doesn’t happen.

    Note that if you copy/paste the code in the “Add Custom JS” page, the same bleeding on the frontend will happen. First we need to find the reason for the aforementioned changes when saving a custom code.

    Could you please make me a list of active plugins on your website so I can test them on my test website? If you have a copy of the website, you can also try deactivating other plugins one by one and see which one changes the custom code upon saving.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Async Script Load Like with AdWords Tags’ is closed to new replies.