2
votes

I am working on Google Analytics chart on my site and in the tracking code I want two add two custom dimension (One is a User ID). I am doing it this way, am I doing it right ? ga('create', 'UA-XXXX', {'userId': spUserId}); ga('set', { 'dimension1': spUserId, 'dimension2': jobAidId }); ga('send', 'pageview');

1

1 Answers

1
votes

Yes, that's correct:

ga('set', {'dimensionX': valueX, 'dimensionY': valueY, 'dimensionZ': valueZ});
ga('send','pageview');

You could also send them with other hits too:

ga('set', {'dimensionX': valueX, 'dimensionY': valueY, 'dimensionZ': valueZ});
ga('send','event', 'cat', 'action', 'label');