`\n\n### 🛠️ To reproduce\n\nhttps://stackblitz.com/edit/nuxt-starter-jnrmuch7?file=pages%2Findex.vue\n\n### 🌈 Expected behavior\n\nGTM should load only in production, as documented:\n\n```\nexport default defineNuxtConfig({\n $production: {\n scripts: {\n registry: {\n googleTagManager: {\n id: 'GTM-XXXXXX',\n },\n },\n },\n },\n})\n```\n\nInstead, GTM is still being registered (or partially initialized) in development, even though it is not declared in the base scripts.registry block.\n\n\n### ℹ️ Additional context\n\nEnvironment:\n\n- Nuxt: 4.0.1\n- @nuxt/scripts: 0.11.10",[3032],{"name":3033,"color":3034},"bug","d73a4a",479,"GTM script loads in development even with $production override","2025-07-23T09:12:32Z","https://github.com/nuxt/scripts/issues/479",0.69903505,{"description":3041,"labels":3042,"number":3046,"owner":3022,"repository":3023,"state":3047,"title":3048,"updated_at":3049,"url":3050,"score":3051},"### 📚 What are you trying to do?\r\n\r\nTrying to add a trigger to the `scriptOptions` for useScriptGoogleTagManager causes a crash\r\n\r\neg\r\n```\r\nuseScriptGoogleTagManager({\r\n key: 'KEY',\r\n scriptOptions: {\r\n trigger: useScriptTriggerConsent({\r\n consent: agreedToCookies\r\n })\r\n },\r\n})\r\n```\r\n\r\n### 🔍 What have you tried?\r\n\r\n_No response_\r\n\r\n### ℹ️ Additional context\r\n\r\n_No response_",[3043],{"name":3044,"color":3045},"help wanted","008672",258,"closed","Unable to trigger google tag manager via consent","2024-09-12T11:47:22Z","https://github.com/nuxt/scripts/issues/258",0.6574564,{"description":3053,"labels":3054,"number":3055,"owner":3022,"repository":3023,"state":3047,"title":3056,"updated_at":3057,"url":3058,"score":3059},"It would be helpful to be able to react to a script getting loaded. Currently the module has a `scripts:updated` hook that can be used for searching for the loaded event, but it is will be inefficient to iterate through the events to find the 'loaded' event, every time there is an update.\r\nInstead I propose a `scripts:loaded` hook that will be called once when the script reaches that status. This allows the developer to react to the specific event and run some logic in response. For instance, you might want to run a consent update or a custom event once a script has been loaded via a consent banner.\r\nAn example implementation could look something like the following inside the `useScript` composable:\r\n```ts\r\nhead.hooks.hook('script:updated', (ctx) => {\r\n if (ctx.script.id !== instance.$script.id)\r\n return\r\n if (ctx.script.status === 'loaded') {\r\n nuxtApp.callHook('scripts:loaded', { [ctx.script.id]: true })\r\n }\r\n // convert the status to a timestamp\r\n payload.events.push({\r\n type: 'status',\r\n status: ctx.script.status,\r\n at: Date.now(),\r\n })\r\n payload.$script = instance.$script\r\n syncScripts()\r\n})\r\n```",[],160,"Hook for scripts being loaded","2024-07-19T06:40:24Z","https://github.com/nuxt/scripts/issues/160",0.6989307,{"description":3061,"labels":3062,"number":3072,"owner":3022,"repository":3022,"state":3047,"title":3073,"updated_at":3074,"url":3075,"score":3076},"Hi,\r\n\r\nI'm testing nuxt for an Amp site. Everything is working perfectly (thanks ❤️ ) except one tiny thing.\r\nIn the examples you gave\r\n``` javascript\r\n// Remove every script tag from generated HTML\r\nhtml = html.replace(/\u003Cscript\\b[^\u003C]*(?:(?!\u003C\\/script>)\u003C[^\u003C]*)*\u003C\\/script>/gi, '')\r\n```\r\nAll scripts tags are removed without consideration, but the solution it not good because amp does allow `\u003Cscript type=\"application/json\">\u003C/script>` (in amp-analytics for example)\r\nIt's not really a bug but it can be confusing for newcomers if they simply copy the code :)\r\n\r\nBecause I'm not a regex master, I didn't succeed in modifying the regex to only match script tags that does not have that type (screw you negative lookahead). So I'v done this (which is absolutely not bulletproof but a quick fix)\r\n```javascript\r\nhtml = html.replace(/\u003Cscript\\b[^\u003C]*(?:(?!\u003C\\/script>)\u003C[^\u003C]*)*\u003C\\/script>/gi, (str) => {\r\n if (/application\\/json/.test(str)) {\r\n return str;\r\n }\r\n return '';\r\n });\r\n```\r\n\r\nIf someone have a better fix 👍 \r\n\r\nthanks\n\n\u003C!--cmty-->\u003C!--cmty_prevent_hook-->\n\u003Cdiv align=\"right\">\u003Csub>\u003Cem>This feature request is available on \u003Ca href=\"https://nuxtjs.cmty.io\">Nuxt.js\u003C/a> community (\u003Ca href=\"https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2569\">#c2569\u003C/a>)\u003C/em>\u003C/sub>\u003C/div>",[3063,3066,3069],{"name":3064,"color":3065},"enhancement","8DEF37",{"name":3067,"color":3068},"stale","ffffff",{"name":3070,"color":3071},"2.x","d4c5f9",2962,"Nuxt amp example: should not remove all script tags","2023-01-18T16:09:49Z","https://github.com/nuxt/nuxt/issues/2962",0.7122503,{"description":3078,"labels":3079,"number":3081,"owner":3022,"repository":3023,"state":3047,"title":3082,"updated_at":3083,"url":3084,"score":3085},"### 📚 What are you trying to do?\n\nHi all!\n\nI need a certain 3rd-party script to be loaded globally for all pages via nuxt.config, but at the same time I don't want it to be loaded on 1-2 pages. How to make it work? Is there an option to create kind of \"blacklist\" of pages I don't want the script to be loaded?\n\n### 🔍 What have you tried?\n\n_No response_\n\n### ℹ️ Additional context\n\n_No response_",[3080],{"name":3044,"color":3045},455,"IS there an option to load a certain script globally, but with several exceptions?","2025-05-19T18:19:47Z","https://github.com/nuxt/scripts/issues/455",0.71398443,{"description":3087,"labels":3088,"number":3090,"owner":3022,"repository":3022,"state":3047,"title":3091,"updated_at":3092,"url":3093,"score":3094},"Hi. is it possible to load component from script tag ?\r\nI am building nw.js app on client side & using nuxt on server side.\r\nThis app needs to load compiled v8 snapshot within xhr response using [nw.Window.get().evalNwBin()](http://docs.nwjs.io/en/latest/For%20Users/Advanced/Protect%20JavaScript%20Source%20Code/).\r\nIn regular html it looks like this:\r\n\r\n```html\r\n\u003Chtml>\r\n\u003Chead>\u003C/head>\r\n\u003Cbody>\r\n\u003Cscript>\r\nvar url = \"/myComponent.bin\";\r\nvar xhr = new XMLHttpRequest();\r\nxhr.responseType = 'arraybuffer'; // make response as ArrayBuffer\r\nxhr.open('GET', url, true);\r\nxhr.send();\r\nxhr.onload = () => {\r\n // xhr.response contains compiled JavaScript as ArrayBuffer\r\n nw.Window.get().evalNWBin(null, xhr.response);\r\n}\r\n\u003C/script>\r\n\u003C/body>\r\n\u003C/html>\r\n```\r\n\r\nor is it possible to use component that loads like:\r\n\r\n```html\r\n\u003Cscript type=\"text/javascript\" src=\"/mycomponent.js\">\u003C/script>\r\n```\r\n\r\nThanks.\n\n\u003C!--cmty-->\u003C!--cmty_prevent_hook-->\n\u003Cdiv align=\"right\">\u003Csub>\u003Cem>This question is available on \u003Ca href=\"https://nuxtjs.cmty.io\">Nuxt.js\u003C/a> community (\u003Ca href=\"https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c973\">#c973\u003C/a>)\u003C/em>\u003C/sub>\u003C/div>",[3089],{"name":3070,"color":3071},1106,"Load component from \u003Cscript> tag","2023-01-18T15:40:45Z","https://github.com/nuxt/nuxt/issues/1106",0.7159903,{"labels":3096,"number":3102,"owner":3022,"repository":3022,"state":3047,"title":3103,"updated_at":3104,"url":3105,"score":3106},[3097,3098,3101],{"name":3067,"color":3068},{"name":3099,"color":3100},"pending triage","E99695",{"name":3070,"color":3071},8178,"Preload tag still added with injectScripts:false & resourceHints:false","2023-01-22T15:38:17Z","https://github.com/nuxt/nuxt/issues/8178",0.7187397,{"description":3108,"labels":3109,"number":3111,"owner":3022,"repository":3022,"state":3047,"title":3112,"updated_at":3113,"url":3114,"score":3115},"it's almost the most developer friendly technology ever,, in my opinion .. keep moving forward.\r\n\r\n**Steps to reproduce**\r\ni'v tryed to add [https://tagmanager.google.com](url) to my nuxt app,\r\nfollowed this example [https://nuxtjs.org/faq/google-analytics](url) here and it works fine for just google analytics,,\r\nunlike analytics .. google tag manager requires two steps to include it in your app the first is a head `script` tag, the other is a `noscript` tag needs to be placed immediately after `body` opening tag.\r\nthis is the script tag included as explaned in the analytics example:\r\n\r\n\r\n\r\nthis the included `noscript` tag:\r\n```\r\n\u003Cnoscript>\r\n \u003Ciframe src=\"//www.googletagmanager.com/ns.html?id=GTM-XXXXXX\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\">\u003C/iframe>\r\n\u003C/noscript>\r\n```\r\nit works but with no effect `router.afterEach()` \r\nand it causes this error\r\n\r\n\r\nthanks in advance ...\n\n\u003C!--cmty-->\u003C!--cmty_prevent_hook-->\n\u003Cdiv align=\"right\">\u003Csub>\u003Cem>This question is available on \u003Ca href=\"https://nuxtjs.cmty.io\">Nuxt.js\u003C/a> community (\u003Ca href=\"https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c580\">#c580\u003C/a>)\u003C/em>\u003C/sub>\u003C/div>",[3110],{"name":3070,"color":3071},674,"google tag manager example","2023-01-18T15:39:39Z","https://github.com/nuxt/nuxt/issues/674",0.7204501,{"description":3117,"labels":3118,"number":3121,"owner":3022,"repository":3122,"state":3047,"title":3123,"updated_at":3124,"url":3125,"score":3126},"https://tailwindui.com/components/application-ui/forms/input-groups#component-a8d111fef35bfae4c800af505ea0d276\n\n- [ ] ModulesFilterSort\n- [ ] CommunityRepositoriesFilterSort",[3119],{"name":3064,"color":3120},"1ad6ff",730,"nuxt.com","Sort dropdowns should have a grouped button for `asc` / `desc`","2023-02-15T12:32:48Z","https://github.com/nuxt/nuxt.com/issues/730",0.7205338,["Reactive",3128],{},["Set"],["ShallowReactive",3131],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fEIqqgLRm5n9KC83hb1BWd4PIP6lGFU1oNBa8CaBvWc0":-1},"/nuxt/scripts/458"]