Both issues have been solved.
The uncaught Syntax Error (showed in Google Chrome console) was due to zero-width spaces (in my case character /u200c) in this line of code:
function(w,d,s,l,i){w[l]?=w[l]?||[]?;w[l].push({'gtm.start':.
As you can see by posting this line of code in this forum it shows question marks on the positions of those zero-width spaces. So always first paste the code in Notepad++ or some other editor to check if it's correct and without zero-width spaces.
I also have succeeded in adding the HTML <noscript> tag right after the opening <body> tag of the webpage.
This post of Shanny Anoep has helped me do it: https://www.outsystems.com/forums/discussion/19670/add-html-javascript-right-after-body-tag/
The only option that has worked for me was the first option in the post. I have managed to add the HTML <noscript> tag immediately after the opening <body> tag of the webpage with the following Jquery code:
SyntaxEditor Code Snippet
$(document).ready(function() {
$(document.body).prepend('<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>');
});
I hope this will help others in the future.