Javascript Google Analytics目标跟踪与正则表达式匹配

Javascript Google Analytics目标跟踪与正则表达式匹配,javascript,regex,google-analytics,Javascript,Regex,Google Analytics,我试图在GA目标url跟踪中跟踪8页的点击。我在页面链接中添加了onclick函数,如下所示 <ul class="slides"> <li class="item-content"><a href="http://www.mysite.com/product/X1234.html" onclick="_gaq.push(['_trackPageView','/featured/Boxes'])"><img src="featured/Boxes.jpg

我试图在GA目标url跟踪中跟踪8页的点击。我在页面链接中添加了onclick函数,如下所示

<ul class="slides">
<li class="item-content"><a href="http://www.mysite.com/product/X1234.html" onclick="_gaq.push(['_trackPageView','/featured/Boxes'])"><img src="featured/Boxes.jpg" alt="Boxes" width="158" height="154" /></a><span class="more"><a href="http://www.mysite.com/product/X1234.html" onclick="_gaq.push(['_trackPageView','/featured/Boxes'])">read more</a></span></li>
<li class="item-content"><a href="http://www.mysite.com/product/B1234.html"  onclick="_gaq.push(['_trackPageView','/featured/Box-Cutter'])"><img src="featured/Box-Cutter.jpg" alt="Box Cutters" width="158" height="154" /></a><span class="more"><a href="http://www.mysite.com/product/B1234.html" onclick="_gaq.push(['_trackPageView','/featured/Box-Cutter'])">read more</a></span></li>
<li class="item-content"><a href="http://www.mysite.com/product/B2289.html"  onclick="_gaq.push(['_trackPageView','/featured/Packing-Tape'])"><img src="featured/Packing-Tape.jpg" alt="Packing Tape" width="158" height="154" /></a><span class="more"><a href="http://www.mysite.com/product/B2289.html" onclick="_gaq.push(['_trackPageView','/featured/Packing-Tape'])">read more</a></span></li>
<li class="item-content"><a href="http://www.mysite.com/product/D1256.html"  onclick="_gaq.push(['_trackPageView','/featured/Markers'])"><img src="featured/Markers.jpg" alt="Markers" width="158" height="154" /></a><span class="more"><a href="http://www.mysite.com/product/D1256.html" onclick="_gaq.push(['_trackPageView','/featured/Markers'])">read more</a></span></li>
</ul>
在我的GA帐户中,我在目标下设置了它,如下所示

<ul class="slides">
<li class="item-content"><a href="http://www.mysite.com/product/X1234.html" onclick="_gaq.push(['_trackPageView','/featured/Boxes'])"><img src="featured/Boxes.jpg" alt="Boxes" width="158" height="154" /></a><span class="more"><a href="http://www.mysite.com/product/X1234.html" onclick="_gaq.push(['_trackPageView','/featured/Boxes'])">read more</a></span></li>
<li class="item-content"><a href="http://www.mysite.com/product/B1234.html"  onclick="_gaq.push(['_trackPageView','/featured/Box-Cutter'])"><img src="featured/Box-Cutter.jpg" alt="Box Cutters" width="158" height="154" /></a><span class="more"><a href="http://www.mysite.com/product/B1234.html" onclick="_gaq.push(['_trackPageView','/featured/Box-Cutter'])">read more</a></span></li>
<li class="item-content"><a href="http://www.mysite.com/product/B2289.html"  onclick="_gaq.push(['_trackPageView','/featured/Packing-Tape'])"><img src="featured/Packing-Tape.jpg" alt="Packing Tape" width="158" height="154" /></a><span class="more"><a href="http://www.mysite.com/product/B2289.html" onclick="_gaq.push(['_trackPageView','/featured/Packing-Tape'])">read more</a></span></li>
<li class="item-content"><a href="http://www.mysite.com/product/D1256.html"  onclick="_gaq.push(['_trackPageView','/featured/Markers'])"><img src="featured/Markers.jpg" alt="Markers" width="158" height="154" /></a><span class="more"><a href="http://www.mysite.com/product/D1256.html" onclick="_gaq.push(['_trackPageView','/featured/Markers'])">read more</a></span></li>
</ul>
目标类型:目的地

正则表达式:^/featured/*

这已经超过48小时了,我亲自点击了这些页面进行测试,但没有得到跟踪

我想我的正则表达式可能是个问题

任何建议都将不胜感激


谢谢

您是否测试过是否确实向GA提出了请求?在你被带到目标url之前,它很有可能没有机会开火。您是否看到常规页面报告中显示的页面?在这方面。。您是否考虑过将其作为事件和/或自定义变量而不是页面视图进行跟踪?因为这样做会增加你的页面浏览量…谢谢你的回复,是的,我确实在我的常规页面报告中看到了这些页面。我现在将对自定义变量进行一些研究。既然你想制定目标,你至少需要使用一个事件,因为自定义变量不能用于创建目标。但是,如果需要,您可能还需要为添加的维度另外弹出一个自定义变量。唯一的缺点是,如果你打算为你的目标做一个漏斗,你不能用事件来做;只有“目的地”(页面视图)类型的目标才能有漏斗(出于某些愚蠢的原因)。但根据你的代码,我不认为你真的希望有一个漏斗来实现这一点。我只是想在这里考虑ALT,因为从表面上看,你的正则表达式并不像你想象的那样,但它仍然应该与链接中的那些页面相匹配
*
将匹配0个或多个上一个字符或组,因此您的正则表达式在技术上匹配0个或多个
/
字符。但是,由于您没有字符串结束锚点
$
,因此后面的内容并不重要,因此在技术上不准确,它仍然应该与这些页面匹配<代码>^/featured/*将是更准确的版本。但是,我也不认为问题出在你的正则表达式上。另一个随机的想法是:页面报告中的页面是否与链接中的页面完全相同?e、 g.
/特色/方框
?也许您有一个过滤器可以对其进行修改,例如添加一个域前缀,使其显示为
www.mysite.com/featured/box
(通常的做法,尤其是当您从多个(子)域获取数据时)。如果是这样,那么你的正则表达式就不匹配了