What is the proper way to setup Live environment on Google Tag Manager?












2















Using Google Tag Manager, I want to use the Environments feature.
While the Environments setup is pretty straightforward, there is a special case regarding the Live environment setup. More specifically, documentation mentions:




Note: Every container is set up with a "Live" environment by default, which always points to the container version that is currently published. You don't need to define the Live environment.




Now, in order to setup GTM in my website for Live, I have 2 possible snippets: the "default" snippet (Which can be obtained by Admin > Install Google Tag Manager in my container) and the "Live" snippet (which can be obtained via Admin > Environments > "Live" > (Actions) Get Snippet).



The problem here is that the first script does not seem to map properly to the Live environment, as using it in a Lookup Table, maps to the default value.



On the other hand, the second script seems to be working properly. My concern is that it uses 2 additional parameters (gtm_auth and gtm_preview), and I am not sure if they should be defined to Live environment. Additionally, several blogs suggest the use of the first script on the Live environment.



My question - and concern is, which of the 2 scripts is the optimal to use in order to setup Live Environment in GTM, in terms of proper installation, usage and security?



Please consider that suggesting the usage of different containers is not an option.










share|improve this question























  • So for the environments variable, it doesn't "return" anything if you're using Live. It will only return a value when you're using the environment snippet or the share preview link. Thus the behavior you're getting with the lookup table is correct and expected. I would suggest you using the non-environment snippet for live, as it doesn't give away anything extra.

    – XTOTHEL
    Nov 20 '18 at 14:53











  • Yes, that's the expected result. It isn't a bug. The environment variable is empty for "Live".

    – XTOTHEL
    Nov 20 '18 at 15:30











  • Can you be more specific regarding the value of Environments variable? Why is it empty in that case? I would expect that, Environment Name variable should return "Live", not nothing. Isn't it true?

    – Nick Louloudakis
    Nov 20 '18 at 15:30











  • Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment "Share Preview" link or from an environment snippet. For the built-in environments, it will return "Live", "Latest", or "Now Editing". In all other cases it returns an empty string. support.google.com/tagmanager/answer/…

    – XTOTHEL
    Nov 20 '18 at 15:31
















2















Using Google Tag Manager, I want to use the Environments feature.
While the Environments setup is pretty straightforward, there is a special case regarding the Live environment setup. More specifically, documentation mentions:




Note: Every container is set up with a "Live" environment by default, which always points to the container version that is currently published. You don't need to define the Live environment.




Now, in order to setup GTM in my website for Live, I have 2 possible snippets: the "default" snippet (Which can be obtained by Admin > Install Google Tag Manager in my container) and the "Live" snippet (which can be obtained via Admin > Environments > "Live" > (Actions) Get Snippet).



The problem here is that the first script does not seem to map properly to the Live environment, as using it in a Lookup Table, maps to the default value.



On the other hand, the second script seems to be working properly. My concern is that it uses 2 additional parameters (gtm_auth and gtm_preview), and I am not sure if they should be defined to Live environment. Additionally, several blogs suggest the use of the first script on the Live environment.



My question - and concern is, which of the 2 scripts is the optimal to use in order to setup Live Environment in GTM, in terms of proper installation, usage and security?



Please consider that suggesting the usage of different containers is not an option.










share|improve this question























  • So for the environments variable, it doesn't "return" anything if you're using Live. It will only return a value when you're using the environment snippet or the share preview link. Thus the behavior you're getting with the lookup table is correct and expected. I would suggest you using the non-environment snippet for live, as it doesn't give away anything extra.

    – XTOTHEL
    Nov 20 '18 at 14:53











  • Yes, that's the expected result. It isn't a bug. The environment variable is empty for "Live".

    – XTOTHEL
    Nov 20 '18 at 15:30











  • Can you be more specific regarding the value of Environments variable? Why is it empty in that case? I would expect that, Environment Name variable should return "Live", not nothing. Isn't it true?

    – Nick Louloudakis
    Nov 20 '18 at 15:30











  • Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment "Share Preview" link or from an environment snippet. For the built-in environments, it will return "Live", "Latest", or "Now Editing". In all other cases it returns an empty string. support.google.com/tagmanager/answer/…

    – XTOTHEL
    Nov 20 '18 at 15:31














2












2








2


1






Using Google Tag Manager, I want to use the Environments feature.
While the Environments setup is pretty straightforward, there is a special case regarding the Live environment setup. More specifically, documentation mentions:




Note: Every container is set up with a "Live" environment by default, which always points to the container version that is currently published. You don't need to define the Live environment.




Now, in order to setup GTM in my website for Live, I have 2 possible snippets: the "default" snippet (Which can be obtained by Admin > Install Google Tag Manager in my container) and the "Live" snippet (which can be obtained via Admin > Environments > "Live" > (Actions) Get Snippet).



The problem here is that the first script does not seem to map properly to the Live environment, as using it in a Lookup Table, maps to the default value.



On the other hand, the second script seems to be working properly. My concern is that it uses 2 additional parameters (gtm_auth and gtm_preview), and I am not sure if they should be defined to Live environment. Additionally, several blogs suggest the use of the first script on the Live environment.



My question - and concern is, which of the 2 scripts is the optimal to use in order to setup Live Environment in GTM, in terms of proper installation, usage and security?



Please consider that suggesting the usage of different containers is not an option.










share|improve this question














Using Google Tag Manager, I want to use the Environments feature.
While the Environments setup is pretty straightforward, there is a special case regarding the Live environment setup. More specifically, documentation mentions:




Note: Every container is set up with a "Live" environment by default, which always points to the container version that is currently published. You don't need to define the Live environment.




Now, in order to setup GTM in my website for Live, I have 2 possible snippets: the "default" snippet (Which can be obtained by Admin > Install Google Tag Manager in my container) and the "Live" snippet (which can be obtained via Admin > Environments > "Live" > (Actions) Get Snippet).



The problem here is that the first script does not seem to map properly to the Live environment, as using it in a Lookup Table, maps to the default value.



On the other hand, the second script seems to be working properly. My concern is that it uses 2 additional parameters (gtm_auth and gtm_preview), and I am not sure if they should be defined to Live environment. Additionally, several blogs suggest the use of the first script on the Live environment.



My question - and concern is, which of the 2 scripts is the optimal to use in order to setup Live Environment in GTM, in terms of proper installation, usage and security?



Please consider that suggesting the usage of different containers is not an option.







google-analytics installation google-tag-manager






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 10:16









Nick LouloudakisNick Louloudakis

3,33932138




3,33932138













  • So for the environments variable, it doesn't "return" anything if you're using Live. It will only return a value when you're using the environment snippet or the share preview link. Thus the behavior you're getting with the lookup table is correct and expected. I would suggest you using the non-environment snippet for live, as it doesn't give away anything extra.

    – XTOTHEL
    Nov 20 '18 at 14:53











  • Yes, that's the expected result. It isn't a bug. The environment variable is empty for "Live".

    – XTOTHEL
    Nov 20 '18 at 15:30











  • Can you be more specific regarding the value of Environments variable? Why is it empty in that case? I would expect that, Environment Name variable should return "Live", not nothing. Isn't it true?

    – Nick Louloudakis
    Nov 20 '18 at 15:30











  • Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment "Share Preview" link or from an environment snippet. For the built-in environments, it will return "Live", "Latest", or "Now Editing". In all other cases it returns an empty string. support.google.com/tagmanager/answer/…

    – XTOTHEL
    Nov 20 '18 at 15:31



















  • So for the environments variable, it doesn't "return" anything if you're using Live. It will only return a value when you're using the environment snippet or the share preview link. Thus the behavior you're getting with the lookup table is correct and expected. I would suggest you using the non-environment snippet for live, as it doesn't give away anything extra.

    – XTOTHEL
    Nov 20 '18 at 14:53











  • Yes, that's the expected result. It isn't a bug. The environment variable is empty for "Live".

    – XTOTHEL
    Nov 20 '18 at 15:30











  • Can you be more specific regarding the value of Environments variable? Why is it empty in that case? I would expect that, Environment Name variable should return "Live", not nothing. Isn't it true?

    – Nick Louloudakis
    Nov 20 '18 at 15:30











  • Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment "Share Preview" link or from an environment snippet. For the built-in environments, it will return "Live", "Latest", or "Now Editing". In all other cases it returns an empty string. support.google.com/tagmanager/answer/…

    – XTOTHEL
    Nov 20 '18 at 15:31

















So for the environments variable, it doesn't "return" anything if you're using Live. It will only return a value when you're using the environment snippet or the share preview link. Thus the behavior you're getting with the lookup table is correct and expected. I would suggest you using the non-environment snippet for live, as it doesn't give away anything extra.

– XTOTHEL
Nov 20 '18 at 14:53





So for the environments variable, it doesn't "return" anything if you're using Live. It will only return a value when you're using the environment snippet or the share preview link. Thus the behavior you're getting with the lookup table is correct and expected. I would suggest you using the non-environment snippet for live, as it doesn't give away anything extra.

– XTOTHEL
Nov 20 '18 at 14:53













Yes, that's the expected result. It isn't a bug. The environment variable is empty for "Live".

– XTOTHEL
Nov 20 '18 at 15:30





Yes, that's the expected result. It isn't a bug. The environment variable is empty for "Live".

– XTOTHEL
Nov 20 '18 at 15:30













Can you be more specific regarding the value of Environments variable? Why is it empty in that case? I would expect that, Environment Name variable should return "Live", not nothing. Isn't it true?

– Nick Louloudakis
Nov 20 '18 at 15:30





Can you be more specific regarding the value of Environments variable? Why is it empty in that case? I would expect that, Environment Name variable should return "Live", not nothing. Isn't it true?

– Nick Louloudakis
Nov 20 '18 at 15:30













Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment "Share Preview" link or from an environment snippet. For the built-in environments, it will return "Live", "Latest", or "Now Editing". In all other cases it returns an empty string. support.google.com/tagmanager/answer/…

– XTOTHEL
Nov 20 '18 at 15:31





Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment "Share Preview" link or from an environment snippet. For the built-in environments, it will return "Live", "Latest", or "Now Editing". In all other cases it returns an empty string. support.google.com/tagmanager/answer/…

– XTOTHEL
Nov 20 '18 at 15:31












1 Answer
1






active

oldest

votes


















1














What you're experiencing is the expected behavior. As per documentation the built-in Environment Variable is defined as follows:




Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment
"Share Preview" link or from an environment snippet. For the built-in
environments, it will return "Live", "Latest", or "Now Editing". In
all other cases it returns an empty string.




In this case, when using the "Share Preview" or the snippet from Admin > Environments > "Live" > (Actions) Get Snippet will result in the variable to be populated.



When using the snippet from Admin > Install Google Tag Manager in my container, the variable will be empty since it isn't an environment snippet.



In terms of installation, I would suggest using the non-environment snippet version for live, as less information is shared publically (values from gtm_auth & env parameters)






share|improve this answer
























  • Ok, the point is, I want to use the default snippet in order to avoid publishing gtm_auth and env parameters. Yet, I want to be able to distinguish Live from default values in a lookup table. I guess this can not be done with environment name in that case, am I right?

    – Nick Louloudakis
    Nov 20 '18 at 15:44











  • I'm guessing you're using default values for staging as a catch-all and wanted to use "Live" for only Live?

    – XTOTHEL
    Nov 20 '18 at 15:47











  • Not exactly the case, yet, I want to distinguish "Live" from default value.

    – Nick Louloudakis
    Nov 20 '18 at 15:55






  • 1





    I think the value/use case for Environments was meant for using the environment snippets for ease of testing.

    – XTOTHEL
    Nov 20 '18 at 16:17






  • 1





    The only downside, as with all your information in GTM is that it is publically available. So if you put in a public IP or staging hostnames, people might try to access it if they get a hold of it.

    – XTOTHEL
    Nov 20 '18 at 16:37











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53390761%2fwhat-is-the-proper-way-to-setup-live-environment-on-google-tag-manager%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














What you're experiencing is the expected behavior. As per documentation the built-in Environment Variable is defined as follows:




Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment
"Share Preview" link or from an environment snippet. For the built-in
environments, it will return "Live", "Latest", or "Now Editing". In
all other cases it returns an empty string.




In this case, when using the "Share Preview" or the snippet from Admin > Environments > "Live" > (Actions) Get Snippet will result in the variable to be populated.



When using the snippet from Admin > Install Google Tag Manager in my container, the variable will be empty since it isn't an environment snippet.



In terms of installation, I would suggest using the non-environment snippet version for live, as less information is shared publically (values from gtm_auth & env parameters)






share|improve this answer
























  • Ok, the point is, I want to use the default snippet in order to avoid publishing gtm_auth and env parameters. Yet, I want to be able to distinguish Live from default values in a lookup table. I guess this can not be done with environment name in that case, am I right?

    – Nick Louloudakis
    Nov 20 '18 at 15:44











  • I'm guessing you're using default values for staging as a catch-all and wanted to use "Live" for only Live?

    – XTOTHEL
    Nov 20 '18 at 15:47











  • Not exactly the case, yet, I want to distinguish "Live" from default value.

    – Nick Louloudakis
    Nov 20 '18 at 15:55






  • 1





    I think the value/use case for Environments was meant for using the environment snippets for ease of testing.

    – XTOTHEL
    Nov 20 '18 at 16:17






  • 1





    The only downside, as with all your information in GTM is that it is publically available. So if you put in a public IP or staging hostnames, people might try to access it if they get a hold of it.

    – XTOTHEL
    Nov 20 '18 at 16:37
















1














What you're experiencing is the expected behavior. As per documentation the built-in Environment Variable is defined as follows:




Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment
"Share Preview" link or from an environment snippet. For the built-in
environments, it will return "Live", "Latest", or "Now Editing". In
all other cases it returns an empty string.




In this case, when using the "Share Preview" or the snippet from Admin > Environments > "Live" > (Actions) Get Snippet will result in the variable to be populated.



When using the snippet from Admin > Install Google Tag Manager in my container, the variable will be empty since it isn't an environment snippet.



In terms of installation, I would suggest using the non-environment snippet version for live, as less information is shared publically (values from gtm_auth & env parameters)






share|improve this answer
























  • Ok, the point is, I want to use the default snippet in order to avoid publishing gtm_auth and env parameters. Yet, I want to be able to distinguish Live from default values in a lookup table. I guess this can not be done with environment name in that case, am I right?

    – Nick Louloudakis
    Nov 20 '18 at 15:44











  • I'm guessing you're using default values for staging as a catch-all and wanted to use "Live" for only Live?

    – XTOTHEL
    Nov 20 '18 at 15:47











  • Not exactly the case, yet, I want to distinguish "Live" from default value.

    – Nick Louloudakis
    Nov 20 '18 at 15:55






  • 1





    I think the value/use case for Environments was meant for using the environment snippets for ease of testing.

    – XTOTHEL
    Nov 20 '18 at 16:17






  • 1





    The only downside, as with all your information in GTM is that it is publically available. So if you put in a public IP or staging hostnames, people might try to access it if they get a hold of it.

    – XTOTHEL
    Nov 20 '18 at 16:37














1












1








1







What you're experiencing is the expected behavior. As per documentation the built-in Environment Variable is defined as follows:




Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment
"Share Preview" link or from an environment snippet. For the built-in
environments, it will return "Live", "Latest", or "Now Editing". In
all other cases it returns an empty string.




In this case, when using the "Share Preview" or the snippet from Admin > Environments > "Live" > (Actions) Get Snippet will result in the variable to be populated.



When using the snippet from Admin > Install Google Tag Manager in my container, the variable will be empty since it isn't an environment snippet.



In terms of installation, I would suggest using the non-environment snippet version for live, as less information is shared publically (values from gtm_auth & env parameters)






share|improve this answer













What you're experiencing is the expected behavior. As per documentation the built-in Environment Variable is defined as follows:




Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment
"Share Preview" link or from an environment snippet. For the built-in
environments, it will return "Live", "Latest", or "Now Editing". In
all other cases it returns an empty string.




In this case, when using the "Share Preview" or the snippet from Admin > Environments > "Live" > (Actions) Get Snippet will result in the variable to be populated.



When using the snippet from Admin > Install Google Tag Manager in my container, the variable will be empty since it isn't an environment snippet.



In terms of installation, I would suggest using the non-environment snippet version for live, as less information is shared publically (values from gtm_auth & env parameters)







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 15:41









XTOTHELXTOTHEL

2,3461210




2,3461210













  • Ok, the point is, I want to use the default snippet in order to avoid publishing gtm_auth and env parameters. Yet, I want to be able to distinguish Live from default values in a lookup table. I guess this can not be done with environment name in that case, am I right?

    – Nick Louloudakis
    Nov 20 '18 at 15:44











  • I'm guessing you're using default values for staging as a catch-all and wanted to use "Live" for only Live?

    – XTOTHEL
    Nov 20 '18 at 15:47











  • Not exactly the case, yet, I want to distinguish "Live" from default value.

    – Nick Louloudakis
    Nov 20 '18 at 15:55






  • 1





    I think the value/use case for Environments was meant for using the environment snippets for ease of testing.

    – XTOTHEL
    Nov 20 '18 at 16:17






  • 1





    The only downside, as with all your information in GTM is that it is publically available. So if you put in a public IP or staging hostnames, people might try to access it if they get a hold of it.

    – XTOTHEL
    Nov 20 '18 at 16:37



















  • Ok, the point is, I want to use the default snippet in order to avoid publishing gtm_auth and env parameters. Yet, I want to be able to distinguish Live from default values in a lookup table. I guess this can not be done with environment name in that case, am I right?

    – Nick Louloudakis
    Nov 20 '18 at 15:44











  • I'm guessing you're using default values for staging as a catch-all and wanted to use "Live" for only Live?

    – XTOTHEL
    Nov 20 '18 at 15:47











  • Not exactly the case, yet, I want to distinguish "Live" from default value.

    – Nick Louloudakis
    Nov 20 '18 at 15:55






  • 1





    I think the value/use case for Environments was meant for using the environment snippets for ease of testing.

    – XTOTHEL
    Nov 20 '18 at 16:17






  • 1





    The only downside, as with all your information in GTM is that it is publically available. So if you put in a public IP or staging hostnames, people might try to access it if they get a hold of it.

    – XTOTHEL
    Nov 20 '18 at 16:37

















Ok, the point is, I want to use the default snippet in order to avoid publishing gtm_auth and env parameters. Yet, I want to be able to distinguish Live from default values in a lookup table. I guess this can not be done with environment name in that case, am I right?

– Nick Louloudakis
Nov 20 '18 at 15:44





Ok, the point is, I want to use the default snippet in order to avoid publishing gtm_auth and env parameters. Yet, I want to be able to distinguish Live from default values in a lookup table. I guess this can not be done with environment name in that case, am I right?

– Nick Louloudakis
Nov 20 '18 at 15:44













I'm guessing you're using default values for staging as a catch-all and wanted to use "Live" for only Live?

– XTOTHEL
Nov 20 '18 at 15:47





I'm guessing you're using default values for staging as a catch-all and wanted to use "Live" for only Live?

– XTOTHEL
Nov 20 '18 at 15:47













Not exactly the case, yet, I want to distinguish "Live" from default value.

– Nick Louloudakis
Nov 20 '18 at 15:55





Not exactly the case, yet, I want to distinguish "Live" from default value.

– Nick Louloudakis
Nov 20 '18 at 15:55




1




1





I think the value/use case for Environments was meant for using the environment snippets for ease of testing.

– XTOTHEL
Nov 20 '18 at 16:17





I think the value/use case for Environments was meant for using the environment snippets for ease of testing.

– XTOTHEL
Nov 20 '18 at 16:17




1




1





The only downside, as with all your information in GTM is that it is publically available. So if you put in a public IP or staging hostnames, people might try to access it if they get a hold of it.

– XTOTHEL
Nov 20 '18 at 16:37





The only downside, as with all your information in GTM is that it is publically available. So if you put in a public IP or staging hostnames, people might try to access it if they get a hold of it.

– XTOTHEL
Nov 20 '18 at 16:37




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53390761%2fwhat-is-the-proper-way-to-setup-live-environment-on-google-tag-manager%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents