问题描述
我在Google Analytics上设置了一些转化渠道。一个是分析从主站点到在虚拟目录上运行的辅助宣传网站(尽管在同一个域上)的流量。我应该补充说,这是一个设置我不能使用其他代码(PHP,JS,C#等),它必须一步完成
因此,例如类似:
- /default.aspx 或 /directory/default.aspx 或 /somedirname/default.aspx
- [to>]
- /promotion/default.aspx
在正则表达式中,这可能是:
问题是Google Analytics不再支持负面lookaheads,所以正则表达式 ^ /(?! promotion)(。*)。aspx 失败。 () p>
有没有另外一种方法可以做到这一点?
非常感谢。
- 无条件取代:
/(。* \.aspx) - > / promotion / $ 1
- 再次替换:
/ promotion / promotion /(.*) - > ; / promotion / $ 1
如果一切都失败:
^ /(?:[^ p] | p [^ r] | pr [^ o] | pro [^ m] | prom [^ o] | promo [^ t] | promoter [^ i] | promoti [^ o] | promotio [^ n])/(。*)\.aspx
I'm setting up some conversion funnels on Google Analytics. One is to analyse traffic going from the main site to a secondary promotional site running on a virtual directory (on the same domain though)
I should add, this is a setup form in Google Analytics, I can't using another other code (PHP, JS, C# etc) and it has to be done in one step
So for example something like:
- /default.aspx or /directory/default.aspx or /somedirname/default.aspx
- [to >]
- /promotion/default.aspx
In regular expression land, this would be:
- ^/(?!promotion)(.*).aspx
- [to >]
- ^/promotion/(.*).aspx
The problem is Google Analytics no longer supports negative lookaheads, so the regexp ^/(?!promotion)(.*).aspx fails. (Reference here, first reply)
Is there another way I can do this?
Many thanks.
You could do a two-step approach (whether that's possible in Analytics, I have no idea, though):
- Replace unconditionally:
/(.*\.aspx) --> /promotion/$1
- Replace again:
/promotion/promotion/(.*) --> /promotion/$1
If all else fails:
^/(?:[^p]|p[^r]|pr[^o]|pro[^m]|prom[^o]|promo[^t]|promot[^i]|promoti[^o]|promotio[^n])/(.*)\.aspx
这篇关于RegExp替代Google Analytics的负面预测匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!