4
votes

I'm starting with google analytics and i don't realize how make it works.

We are making a site and we want to add the user name as custom variable in google analytics in order to analyze the behavior of each user with the site.

For this, i start to use google analytics (analytics.js) a couple weeks ago and i created a custom dimension (to know who user access) and a custom metric (to know how many visits made) as it's indicated in documentation.

The dimension and metric were created with session scope because those values must be sent once per session.

After that, i add the code needed as is explained here:

ga('create', 'UA-#######-1', 'domain.com');

ga('set', {
  'dimension1': 'userName',
  'metric1': 1
});      

ga('send', 'pageview');

I've tried this code and others configurations but google analytics doesn't take the values. Look this image (http://snag.gy/Ou8vG.jpg)

What i'm doing bad? it can be because i'm sending the request with 'pageview' and the dimension is scoped with session?

1

1 Answers

5
votes

Finally worked!!

Apparently you must wait a time (like 2 days for me) before Google starts to record the information. Documentation not specified this detail.

I hope this answer helps other people with the same question!!