Universal Analytics-为一个维度和一个综合浏览量推送多个值 [英] Universal Analytics - push multiple values for one dimension and one pageview

查看:50
本文介绍了Universal Analytics-为一个维度和一个综合浏览量推送多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Google通用分析及其自定义维度.

I am trying to use google universal analytics and its custom dimensions.

在一页上,我要为一个(仅一个)维度发送多个值.

On one page, I want to send multiple values for one (and one only) dimension.

我尝试过:

ga('send', 'pageview', {'dimension1': 'grumpy cat'})
ga('send', 'pageview', {'dimension1': 'happy cat'})

使用Google API时,我可以为我的Dimension1获取所有刚发送的值-这样就可以正常工作.

When I use google API, I can get for my dimension1 all the values I just sent - so it works well.

但是,我认为(我不确定)我不应在同一页面上发送多次综合浏览量,因为这会破坏综合浏览量指标.

However I think (I am not sure about it) that I should not send several times a pageview hit on the same page because it would disrupt the pageview metric.

因此,我尝试使用自定义指标(网页浏览量毕竟是指标):

So I tried to use a custom metric (pageview is a metric after all):

ga('send', 'metric1', {'dimension1': 'grumpy cat'})
ga('send', 'metric1', {'dimension1': 'happy cat'})

但是这个根本不起作用:( 似乎ga.('send'...只接受pageview,但是很奇怪(如果可能的唯一值,为什么要在参数中指定pageview?)

But this one doesn't work at all :( It seems ga.('send'... only accepts pageview but it is weird (why specify pageview in the arguments if it is the only value possible?)

我该如何解决我的问题?这仅仅是语法问题,使用自定义维度/自定义指标是不可能的吗?我可以实际使用pageview来做到这一点吗?我应该使用自定义事件来代替吗?

How can I solve my problem? Is it just a syntax issue, is it not possible with custom dimension / custom metric? Can I actually use pageview to do it? Should I use custom events instead of that?

谢谢!

*编辑*

我实际上发现我可以使用带有以下标签的事件:

I actually found out that I may use an event with a label like:

ga('send', 'event', 'cat', 'view', 'grumpy')
ga('send', 'event', 'cat', 'view', 'happy')

(如果有人可以确认或发表评论,我会很高兴)

(If anyone can confirm it or have comments I would be happy with that)

推荐答案

前一段时间我遇到了类似的问题.事实是,您不能在Google Analytics(分析)(GA)和Universal Analytics(UA)中将多个值推入单个自定义变量(维度或指标).当您为单个页面(或会话或用户,取决于自定义变量,维度或指标的范围,如果您使用的是UA)将多个值推入自定义变量,维度或指标时,会发生以下情况:最后报告的值是唯一记录的值.最后一个值将覆盖先前设置的值.因此,您尝试为自定义变量(或维度)记录两个具有2个不同值的综合浏览量.

I had a similar problem a while back. The thing is, you cannot push multiple values to a single custom variable (dimension or metric) in both Google Analytics (GA) and Universal Analytics (UA). What happens when you push more than one value to a custom variable, dimension, or metric for a single page (or session or user, depending upon the scope of the custom variable, dimension or metric, if you're using UA) is that the last reported value is the only one that is recorded. The last value overrides the previously set value. So, you have tried to record two pageviews with 2 different values for your custom variable (or dimension).

在您的情况下,假设某人在包含两个类别(grumpy cathappy cat)之后加载了搜索结果页面,并且您想通过报告该变量(或维度)将它们都记录在自定义变量或维度中)两次,如果按照您提到的顺序发送,

In your case, say a person loads a search results page after having included two categories, grumpy cat and happy cat, and you want to record both of them in a custom variable or dimension by reporting the variable (or dimension) twice, and if you send them in the order you mentioned,

ga('send', 'pageview', {'dimension1': 'grumpy cat'});
ga('send', 'pageview', {'dimension1': 'happy cat'});

您只是在记录两个不同的综合浏览量(根据您可能拥有的数量或类别,它们将以无数种方式歪曲您的报告).例如,如果某人访问了5个以上的类别,您将获得重复的综合浏览量,并且您的页面停留时间将大大减少,因为根据UA(或GA),这些综合浏览量(最后一个除外)的持续时间要短一些超过一秒钟.

you are simply recording two different pageviews (which will skew your reports in innumerable ways, depending on the number or categories you may have). For example, if a person visits more than 5 categories, you will have duplicate pageviews, and your time on page will be drastically reduced, as according to UA (or GA) these pageviews (except for the last one) would have lasted for less than one second.

此外,您要链接到这些自定义变量(或维度)的任何事件都只会链接到上次推送的综合浏览量或自定义变量(或维度).举例来说,如果您设置了事件跟踪功能以识别有多少人与搜索结果互动,然后又想按类别进行过滤(现在是dimension1),以了解有多少人与搜索结果互动当dimension1等于grumpy cat的页面时,您将获得0,因为事件只会记录d dimension1等于happy cat的页面浏览,因为那是GA(或UA)认为用户拥有的页面触发事件时一直在查看,并且该页面仅将dimension1设置为happy cat.由于这两个调用是async,即使我已经解释了,您实际上也永远无法知道事件是否已发送到您认为去过的浏览量.

Also, any events you wanted to link to those custom variables (or dimensions), would only be linked to the last pushed pageview or custom variable (or dimension). As an example, if you had an event tracking set up to identify how many people interacted with the search results, and if you then wanted to filter by category (dimension1 in your case now), to know how many people interacted with the page when dimension1 equals grumpy cat you would get 0, as the events would have only been recorded for the pageview with ddimension1 equal to happy cat because that was the page which GA (or UA) thinks the user had been viewing when firing the event, and that page only had dimension1 set to happy cat. Since those two calls are async, you would actually never be able to know if the events were sent to the pageview you think it went to, even as I explained.

记录这种类型数据的更好方法是使用url编码的类别名称,使用空格分隔,并在列表末尾附加一个空格.例如,您必须以以下方式发送综合浏览量:

The better way to record this type of data would be to use url-encoded category names, space separated, and a space appended to the end of the list also. As an example, you must send the pageview as,

ga('send','pageview',{'dimension1':'grumpy-cat happy-cat '});

或更好的

ga('set',{'dimension1':'grumpy-cat happy-cat '});
ga('send','pageview');

也请注意末尾的空格.此多余的空间使您可以使用reg-ex <categoryName>\s根据自定义变量过滤任何报告.例如,要找出有多少人浏览了类别为脾气暴躁的猫"的网页,您将过滤报告,使dimension1与正则表达式grumpy\-cat\s匹配.我已经使用\-转义了正则表达式中的-字符,而\s代表空格字符.好消息是,这样的报告将获取您所有的页面浏览量(或您要查看的任何内容),仅以grumpy cat作为类别名称的那些页面访问以及在类别中具有grumpy cat的那些页面. 页面所属的页面.

Note the space at the end also. This extra space allows you to filter any report based on the custom variable using the reg-ex <categoryName>\s. As an example, to find out how many people viewed a page with category Grumpy Cat, you will filter your report such that the dimension1 matches regex grumpy\-cat\s. I have escaped the - character in regex using \-, and \s stands for a whitespace character. The good thing is, such a report will fetch you all pageviews (or whatever you want to look at), those with only the grumpy cat as category name, as well as those pages which have grumpy cat in the categories to which a page belongs.

添加子类别的一种方式是将尺寸作为cat1 cat1-subcat1 cat1-subcat2 cat2 cat2-subcat1发送,以便正则表达式cat1\s将处理所有类别级别的页面,而正则表达式cat1将处理具有类别cat1的所有页面.或具有属于cat1的子类别.

A way to add subcategories is to send dimensions as cat1 cat1-subcat1 cat1-subcat2 cat2 cat2-subcat1 so that the regex cat1\s will take care of all category level pages, whereas the regex cat1 will take care of all pages which have category cat1 or which have a subcategory belonging to cat1.

希望有帮助. :)

顺便说一句,对包含类别的页面的视图使用事件不是记录它的好方法.因为,如果您指定维度(这是引入自定义维度的原因之一,因为不同的网站具有不同的类别,而Google不能全部命名),那么您的事件也会包含页面的维度,这对您有很大帮助只需按dimension1细分报告,即可确定需要哪些类别.例如,您将了解哪个类别的SEO访问次数最高,哪个类别的转化率最佳,等等.祝您分析愉快! :)

On a side note, using events for views of a page containing a category is not a nice way of recording it. Because, if you assign dimensions (and this is one of the reasons why custom dimensions were introduced, as different sites have different categories and Google can't name all), your events will also carry the dimensions of the page and it helps a lot to identify which categories are in need of what, by simply segmenting your reports by, in your case, dimension1. For example, you will get to know which category has highest SEO visits and which has the best conversion rates, and stuff. Happy analysing! :)

这篇关于Universal Analytics-为一个维度和一个综合浏览量推送多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆