Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow changing the Google Tag Manager script src #404

Open
Reyno-Skeps opened this issue Feb 25, 2025 · 5 comments · May be fixed by #408
Open

Allow changing the Google Tag Manager script src #404

Reyno-Skeps opened this issue Feb 25, 2025 · 5 comments · May be fixed by #408
Labels
enhancement New feature or request

Comments

@Reyno-Skeps
Copy link

🆒 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

@Reyno-Skeps Reyno-Skeps added the enhancement New feature or request label Feb 25, 2025
@ThiloHettmer
Copy link

ThiloHettmer commented Feb 27, 2025

@Reyno-Skeps do you want to create a pull request? We need this too and otherwise I would create one

@Reyno-Skeps
Copy link
Author

@ThiloHettmer Just submitted a PR.

@ThiloHettmer
Copy link

Bump for awareness ;)

@blowsie
Copy link

blowsie commented Mar 19, 2025

Related #397

@blowsie
Copy link

blowsie commented Mar 28, 2025

This may help
#434

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants