You can use Head in any components by Nextjs. How about you add Head in Page and put <script/> inside


You could listen to the script load event from your <Page> component using vanilla javascript. in your custom _document:

<script id="dtm" src="dtm.js" />

then in the <Page> component:

document.getElementById("dtm").addEventListener('load', () => {
  // DTM is loaded

Related Query

More Query from same tag