Any advice on how to get around this error?", "author": { "@type": "Person", "name": "Charlie", "image": "https://ia800305.us.archive.org/31/items/discordprofilepictures/discordblue.png", "url": "https://discordapp.com/users/1297897026100662284" }, "datePublished": "2024-12-18T13:17:58.002+00:00" } ], "text": "I'm trying to load a 3rd party script that needs to be in the body but keeps coming back with the error:Code found in the page . Please place code directly before the I've tried it as a component, setting script type to module, as the last element on the page but nothing seems to be working. The code snippet is pretty basic - example below:Any advice on how to get around this error?" }
Pricing Blog

Adding a script tag just before </body>

  • charlie_84787-1318930257813704745

    Charlie

    6 months ago

    I'm trying to load a 3rd party script that needs to be in the body but keeps coming back with the error:
    Code found in the page <head>. Please place code directly before the </body>

    I've tried it as a component, setting script type to module, as the last element on the page but nothing seems to be working. The code snippet is pretty basic - example below:

    <script type="text/javascript">
    var vglnk = {key: '454b80f1502c'};
    (function(d, t) {var s = d.createElement(t);
    s.type = 'text/javascript';s.async = true;
    s.src = '//cdn.viglink.com/api/vglnk.js';
    var r = d.getElementsByTagName(t)[0];
    r.parentNode.insertBefore(s, r);
    }(document, 'script'));
    </script>

    Any advice on how to get around this error?