Next.js Discord

Discord Forum
","dateCreated":"2025-02-20T18:16:56.841Z","answerCount":3,"author":{"@type":"Person","name":"Colombian fino hound"},"suggestedAnswer":{"@type":"Answer","text":"instead of creating another script tag inside your script tag, you can create the expected script directly like this:","url":"https://nextjs-forum.com/post/1342198322156404756#message-1342247572974075997","dateCreated":"2025-02-20T21:32:39.151Z","author":{"@type":"Person","name":"B33fb0n3"}}}}

Loading a third party form script on a static page

Unanswered
Colombian fino hound posted this in #help-forum
Open in Discord
Avatar
Colombian fino houndOP
We are loading a third party form using JS on some of our pages. But Google Page Speed is flagging us due to "Remove the impact of third party code" -- what would be the best way to load the following script in Next JS? <div data-paperform-id="xxxxxx"></div><script>(function() {var script = document.createElement('script'); script.src = "https://paperform.co/__embed.min.js"; document.body.appendChild(script); })()</script>

3 Replies

Avatar
Colombian fino houndOP
For a static page, where is the best place to put these so they are non-render blocking?
Avatar
@Colombian fino hound For a static page, where is the best place to put these so they are non-render blocking?
Avatar
if you using the Script tag, nextjs will automatically place it at the correct position