当前位置: 动力学知识库 > 问答 > 编程问答 >

Universal Analytics Google - Custom dimensions

问题描述:

What's the difference between

ga('send', 'pageview', {

'dimension1': 'data goes here'

});

and

ga('set', 'dimension1', 'data goes here');

ga('send', 'pageview');

Doesn't it accomplish the same thing?

网友答案:

If you limit the answer the way you framed your question there is no difference at all.

The difference is that when you use set that custom dimension will be sent with every hit in the current page. Here's a better example:

1) In this example the pageview has the custom dimension attached but the event does not.

ga('send', 'pageview', {
  'dimension1':  'data goes here'
});
ga('send', 'event', 'Category', 'Action');

2) In this second example both the pageview and the event have the custom dimension attached.

ga('set', 'dimension1', 'data goes here');
ga('send', 'pageview');
ga('send', 'event', 'Category', 'Action');
分享给朋友:
您可能感兴趣的文章:
随机阅读: