问题描述
我正在开发一个使用javascript客户端mvc(本例中为angular.js)的js单页web应用程序。
我将Google分析添加到网站,但从我目前看到的(至少在实时)谷歌并没有考虑到哈希后的部分uri
这是我有一个像 有什么想法? 您需要解析#之后的参数,并通过使用_trackPageview发送数据,以便在您的网页上查看它们。 以下是如何操作, I'm developing a js single-page web application using a javascript client side mvc (angular.js in this case) I added google analytic to the site, but from what I could see so far (at least in realtime) google doesn't take into account the part of the uri after the hash that is I have a url like any idea? You need to parse the parameters after # and send the data by using _trackPageview in order to see them on your pages report. and here is how to do it, 这篇关于使用谷歌分析处理哈希#的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! mydomain.com.ar /#/ ideas / 1
这样的网址,但对于谷歌分析来说,它看起来就像 mydomain.com.ar / $ c
var params = {},
queryString = location.hash.substring(1),
regex = /([^& =] +)=([^&] *)/ g,
m;
while(m = regex.exec(queryString)){
params [decodeURIComponent(m [1])] = decodeURIComponent(m [2]);
}
_gaq.push(['_ trackPageview',queryString]);
mydomain.com.ar/#/ideas/1
but for google analytics it looks just like mydomain.com.ar/
var params = {},
queryString = location.hash.substring(1),
regex = /([^&=]+)=([^&]*)/g,
m;
while (m = regex.exec(queryString)) {
params[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}
_gaq.push(['_trackPageview', queryString]);