Skip to content

Allow changing the Google Tag Manager script src #404

Open
@Reyno-Skeps

Description

@Reyno-Skeps

🆒 Your use case

For server-side tagging a custom src needs to be set for Google Tag Manager.

Currently this src is hard coded in:

src: withQuery('https://www.googletagmanager.com/gtm.js', { id: options?.id, l: options?.l }),

Whenever we want to change the src manually the ID is no longer appended, make it so we have to define the ID twice.

googleTagManager: {
	id: 'GTM-123456',
	scriptInput: {
		src: 'https://gtm.example.com/gtm.js?id=GTM-123456',
	},
},

🆕 The solution you'd like

A simple solution to the problem could be to add an option for the src.

src: withQuery(options?.src || 'https://www.googletagmanager.com/gtm.js', { id: options?.id, l: options?.l }),

Which makes it so we can easily change it like so:

googleTagManager: {
	id: 'GTM-123456',
	src: 'https://gtm.example.com/gtm.js'
},

🔍 Alternatives you've considered

No response

ℹ️ Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions