gtm-module icon indicating copy to clipboard operation
gtm-module copied to clipboard

Environment support

Open Jymiz-Tech opened this issue 4 years ago • 5 comments

Hey,

is there any way to support

https://support.google.com/tagmanager/answer/6311518?hl=fr

With this plugin? it changes a bit the import script

Thanks

Jymiz-Tech avatar Apr 24 '20 10:04 Jymiz-Tech

Hi @Jymiz-Tech. I think you may use variables option but usually, it is with an iframe by google. Would you please explain more about "it changes a bit the import script"?

pi0 avatar Apr 24 '20 14:04 pi0

@pi0 I guess it's because it appends some additional params to the query when loading the script (something along gtm_preview=environment_name)

ThePeach avatar May 04 '20 12:05 ThePeach

This is something that I too would need, together with the environment name, there are two more params that are sent to enable environments, specifically gtm_cookies and gtm_auth, at least from what I can see on the generated code by GTM after enabling environments support

ThePeach avatar May 04 '20 12:05 ThePeach

@ThePeach please try variables. It is exactly to send params with script URL :)

pi0 avatar May 04 '20 14:05 pi0

The variables property worked for me, btw:

gtm: {
  id: 'GTM-xxxx',
  variables: {
    gtm_auth: 'xxxx',
    gtm_preview: 'xxxx',
    gtm_cookies_win: 'xxxx',
  }
}

weotch avatar Jan 15 '21 19:01 weotch