Skip to content

GoogleTagManager: Custom gtm.js source loads default source #249

Closed
@Mokkapps

Description

@Mokkapps

🐛 The bug

We're defining a custom gtm.js source URL like this in our nuxt.config.ts:

  scripts: {
    registry: {
      // @ts-expect-error - crossorigin is not typed as boolean
      googleTagManager: {
        scriptInput: {
          crossorigin: false,
          src: 'https://custom-domain.com/gtm.js?id=GTM-12345',
        },
      },
    },
  },

It works but in the network tab we can see that https://www.googletagmanager.com/gtm.js is tried to be loaded before the actual custom source is fetched with success.

The first call fails:

image

Unfortunately, I cannot provide a reproduction because the custom source is from my client. If you have any test URL for me, I'm happy to create a reproduction.

🛠️ To reproduce

🌈 Expected behavior

Only the custom source is loaded

ℹ️ Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions