gtm-support / vue-gtm

Simple implementation of Google Tag Manager for Vue
https://www.npmjs.com/package/@gtm-support/vue-gtm
MIT License
198 stars 23 forks source link

Add ability to load local gtm.js #369

Closed spyderdsn closed 10 months ago

spyderdsn commented 10 months ago

Request / Idea

Google Chrome Extension Manifest v3 blocks loading external scripts, even their own. In this case, this implementation no longer works as the content security policy throws an error with: https://www.googletagmanager.com/gtm.js

The solution is to add the ability to load local gtm.js or include gtm.js into this package with an optional flag.

Additional Context

More here: https://groups.google.com/a/chromium.org/g/chromium-extensions/c/0mPEDNJA0XM?pli=1

Shinigami92 commented 10 months ago

I'm not sure if it is legally allowed to include a copy of gtm.js in this repo, but maybe we could implement an option to load it manually.

... uhm ... but to be honest... I think the option config.source already exists :eyes:

https://github.com/gtm-support/core/blob/9391b2d691dcff0dd75446c4ddbce3b916e60652/src/utils.ts#L105C13-L105C13

It's even documented here in the README: https://github.com/gtm-support/vue-gtm#configuration

Does this not work for you somehow?!