如何动态获取值?

时间:2021-11-20 13:40:49

Where do I get the values?

我从哪里得到这些值?

Below is the script to track usertype, Here I have used custom variable to track the usertype..

下面是跟踪usertype的脚本,这里我使用了custom变量来跟踪usertype。

pageTracker._setCustomVar(1, "Usertype", <<dynamically fill Usertype>>, 1)

In above script, how do I dynamically get the values

在上面的脚本中,如何动态地获取值

Example: If it is the guest user, I need to fill dynamic value as "guest"

示例:如果是来宾用户,我需要以“guest”填充动态值

pageTracker._setCustomVar(1, "Usertype", guest, 1)

If user is member after logged in, I need to fill dynamic value as "member"

如果用户登录后是成员,我需要填写动态值作为“成员”

pageTracker._setCustomVar(1, "Usertype", member, 1)

Please anyone help me or give me a solution

请大家帮帮我,或者给我一个解决办法

2 个解决方案

#1


1  

place hidden fields in the aspx part:

在aspx部分放置隐藏字段:

<asp:HiddenField ID="User" runat="server" ></asp:HiddenField>

from code behind

从代码后面

User.Value = "XXXXXX";

And In the script

和脚本

var varuser = document.getElementById("User").value;
pageTracker._setCustomVar(1, "Usertype", varuser, 1)

#2


0  

You can also cal an method or property in your designer view:

您还可以在设计器视图中调用一个方法或属性:

pageTracker._setCustomVar(1, "Usertype", <%= Helper.GetUserType() %>, 1)

#1


1  

place hidden fields in the aspx part:

在aspx部分放置隐藏字段:

<asp:HiddenField ID="User" runat="server" ></asp:HiddenField>

from code behind

从代码后面

User.Value = "XXXXXX";

And In the script

和脚本

var varuser = document.getElementById("User").value;
pageTracker._setCustomVar(1, "Usertype", varuser, 1)

#2


0  

You can also cal an method or property in your designer view:

您还可以在设计器视图中调用一个方法或属性:

pageTracker._setCustomVar(1, "Usertype", <%= Helper.GetUserType() %>, 1)