跟踪目标渠道中的锚链接 [英] Tracking Anchor Links in Goal Funnels
问题描述
在我的网站上,我有一个跨两个步骤的表单,每步1个帖子回到同一页面并加载表单的第二部分。步骤1和步骤2之间在URL方面的唯一区别是url中的锚文本
例如
第1步:www.mysite.com/enquiry/
第2步:www.mysite.com/enquiry/#message
是否可以跟踪这些在目标funnnels?如果没有,我必须将一些跟踪参数硬编码到GA代码中?
_setAllowAnchor(bool)
不会解决您的问题;这是允许Google Analytics从锚点读取广告系列查询字符串的功能(即#utm_medium = cpc
。)
你需要包含一个像这样的插件来处理过去的IE问题:
a href =http://benalman.com/code/projects/jquery-hashchange/docs/files/jquery-ba-hashchange-js.html =nofollow noreferrer> http://benalman.com/code /projects/jquery-hashchange/docs/files/jquery-ba-hashchange-js.html
以下内容应该附加一个功能给跨浏览器兼容的hashchange事件,然后创建一个虚假网页浏览,让您可以在Google Analytics中单独跟踪它。
$ b $
$(window).hashchange(function(){
_gaq.push(['_ trackPageview',location。路径名+ location.search + location.hash]);
});
});
这应该比其他一些选项具有更广泛的兼容性。
在GA中,在您的陈述示例中,锚定页面将跟踪为 / inquiry /#message
。
On my site I have a form that spans 2 steps each step 1 posts back to the same page and loads the second part of the form. The only difference between step 1 and step 2 in terms of URL is an anchor text in the url
e.g.
STEP 1 : www.mysite.com/enquiry/ STEP 2 : www.mysite.com/enquiry/#message
is it possible to track these in goal funnnels? If not would i have to hardcode some tracking paramater into the GA code?
_setAllowAnchor(bool)
won't solve your problem; that's a function for allowing Google Analytics to read campaign query strings from the anchor (ie, #utm_medium=cpc
.)
This can be hard to do reliably cross-browser without something like jQuery.
You'll need to include a plugin like this to deal with past IE problems: http://benalman.com/code/projects/jquery-hashchange/docs/files/jquery-ba-hashchange-js.html
The following should attach a function to a cross-browser compatible hashchange event, and then create a 'fake' pageview to allow you to track it separately in Google Analytics.
$(window).hashchange( function() {
_gaq.push(['_trackPageview',location.pathname+location.search+location.hash]);
});
});
This should have wider compatibility than some of the other options.
In GA, in your stated example, the 'anchored' page will track as /enquiry/#message
.
这篇关于跟踪目标渠道中的锚链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!