How to see Google Analytics dimension variables on Dashboard

丶灬走出姿态 提交于 2019-12-25 12:23:10

问题


I am going through a strange problem; may be I am doing something wrong.

I need to see list of all Usernames (and their analytics) which logged in on my site. I created a dimension1 variable and listed as "User Name" with a "Session" type on Google Analytics.

Here is what I did in my code:-

P.S. This code is in analyticstracking.php which is at the end of the page (after the "body" tag)

var user = "<?php echo $_SESSION['username']; ?>";

  if (user) {
    //alert(user);
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-XXXXXXXX-1', 'thesite.com');

    var dimensionValue = user;

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

    ga('send', 'pageview');
}

This is what I did in Google Analytics:-

Now I am hoping that after doing all this, I'd see the list of all recorded Usernames and when I click on them, It'd show me all the respective analytics.

But nothing is happening.

Any idea if I am doing something wrong?

Thanks


回答1:


Yep, to create a custom report:

  1. log into GA and go to "Customization" at the top, and then click "+ New Custom Report".
  2. Select the metrics you want to see for the custom report e.g. sessions, pageviews, etc.
  3. Select the dimension you want to see. In your case, that will be User Name.
  4. Click save.

You should now see your data.

Again, I would strongly urge you to use User Id rather than User Name.



来源:https://stackoverflow.com/questions/23274021/how-to-see-google-analytics-dimension-variables-on-dashboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!