Javascript 如何跟踪;提交;按钮使用谷歌分析? 关于 QOS Technology是印度唯一一家为使用Check Point安全产品的客户提供独家Check Point支持和服务的公司 月刊
订阅我们的时事通讯,了解最新的检查站安全新闻和更新 @使用(Html.BeginForm(“Subscribe”、“Home”、FormMethod.Post、new{id=“subscribebeform”、@style=“display:inline;”})) { @Html.AntiForgeryToken() 订阅 } 请帮我设置事件跟踪。google analytics反映了页面浏览量,我还尝试加入类似onclick=“ga(……………)但它没有反映任何内容。我们的网站是建立在Asp.Net上的,所以下面的页脚代码是这样的。我只想跟踪新闻稿提交按钮。例如,当用户输入他的电子邮件Id并单击订阅按钮时。我已经在页面中粘贴了谷歌分析片段,谷歌正在正确反映页面视图Javascript 如何跟踪;提交;按钮使用谷歌分析? 关于 QOS Technology是印度唯一一家为使用Check Point安全产品的客户提供独家Check Point支持和服务的公司 月刊,javascript,google-analytics,event-tracking,Javascript,Google Analytics,Event Tracking,订阅我们的时事通讯,了解最新的检查站安全新闻和更新 @使用(Html.BeginForm(“Subscribe”、“Home”、FormMethod.Post、new{id=“subscribebeform”、@style=“display:inline;”})) { @Html.AntiForgeryToken() 订阅 } 请帮我设置事件跟踪。google analytics反映了页面浏览量,我还尝试加入类似onclick=“ga(……………)但它没有反映任何内容。我们的网站是建立在Asp
谢谢嗯,这取决于表单将用户引向何处。如果表单将用户重定向到另一个页面,我建议将分析代码段添加到另一个页面。如果您无法更改该页面,请添加另一个带有代码段的文件以充当“桥梁”"; 该页面使用分析跟踪用户计数,并自动将其重定向到目标页面
如果您只是对订阅按钮使用javascript单击事件,则可以向该方法添加AJAX事件。使用该按钮加载另一个包含分析代码段的页面。为什么跟踪可能有问题:如果在提交按钮后网站在othew网站页面上重定向,GA可能没有足够的时间将点击发送到GA服务器(在单击之后和重定向之前,有时这个时间是毫秒) 可能的解决方案:
- 当用户试图发送表单时,我们将停止此操作(默认情况下)
- 之后,我们使用“hitCallback”函数向GA发送事件李>
- 作为“hitCallback”的回调函数,我们需要设置表单的提交,这在第1页中被阻止。回调函数仅在命中率100%传递给GA后触发
<!--=== Footer ===-->
<div class="footer">
<div class="container">
<div class="row-fluid">
<div class="span4">
<!-- About -->
<div class="headline">
<h3>About</h3>
</div>
<p class="margin-bottom-25">QOS Technology is the only company in India which offers exclusive Check Point support and services to customers who are using Check Point security products.</p>
<!-- Monthly Newsletter -->
<div class="headline">
<h3>Monthly Newsletter</h3>
</div>
<p>Subscribe to our newsletter and stay up to date with the latest checkpoint security news and updates!</p>
@using (Html.BeginForm("Subscribe", "Home", FormMethod.Post, new { id = "subscribeForm", @style = "display: inline;" }))
{
@Html.AntiForgeryToken()
<div class="input-append">
<input type="email" id="subscriptionEmail" name="email" placeholder="Email Address" class="input-medium" />
<button type="submit" class="btn btn-u">Subscribe</button>
</div>
}
</div>