我在标记文件中定义了一个javascript全局变量,我想在Google跟踪代码管理器的标签中读取该变量

时间:2021-12-20 15:15:36

In my .tag file, I had defined a globalLanguage variable, as for example,

在我的.tag文件中,我定义了一个globalLanguage变量,例如,

<script language="JavaScript" type="text/javascript">
       globalLanguage = "${sessionScope.language.isocode}"
</script>

In Google Tag Manager, I want to read the value of this globalLanguage, like,

在Google跟踪代码管理器中,我想要读取此globalLanguage的值,例如,

<script type="text/javascript">
var certona = {
"language" : globalLanguage (?doubt)
}; </script>

Please help me in reading the globalLanguage variable defined in the tag file to the Google Tag Manager?

请帮助我将标记文件中定义的globalLanguage变量读取到Google跟踪代码管理器?

Any help with respect to Google Tag Manager, will be more useful.

任何有关Google跟踪代码管理器的帮助都会更有用。

1 个解决方案

#1


0  

Use LocalStorage for save and get that value in any where.

使用LocalStorage进行保存并在任何位置获取该值。

localStorage.setItem('globalLanguage ', YOUR VALUE SAVE HERE); 
and get using
var ans = localStorage.getItem('globalLanguage ');
alert(ans);

#1


0  

Use LocalStorage for save and get that value in any where.

使用LocalStorage进行保存并在任何位置获取该值。

localStorage.setItem('globalLanguage ', YOUR VALUE SAVE HERE); 
and get using
var ans = localStorage.getItem('globalLanguage ');
alert(ans);