Reputation: 4044
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?
Upvotes: 0
Views: 130
Reputation: 22832
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');
Upvotes: 2