开发者

Adding information to a google analytics pageview

I use google analytics to monitor my traffic. For some pages, I want to record extra information beyond just the page being viewed. For example, if someone visits a profile page I might want to also record if that profile is a celebrity.

I don't want to artificially alter the URL 开发者_运维知识库for this. Can I add data to a pageview like I can with GA events? And of course, then I'd like to analyze traffic based on that data.


If you really want to use the URL (which I wouldn't recommend) to send meta-data, you could send it as a second parameter in the _trackPageview call:

_gaq.push(["_trackPageview", "/custom-url-for-celebrity-view]);

The better way for you to do it, though, would be to use Custom Variables

_gaq.push(["_setCustomVar", 1, "Page Type", "Celebrity Profile", 3]);
_gaq.push(["_trackPageview"]);

That way, your natural URL data is preserved, but the custom variable provides the meta data you'd like to know.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜