php - How to see Google Analytics dimension variables on Dashboard -
i going through strange problem; may doing wrong.
i need see list of usernames (and analytics) logged in on site. created dimension1 variable , listed "user name" "session" type on google analytics.
here did in code:-
p.s. code in analyticstracking.php
@ end of page (after "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 did in google analytics:-
now hoping after doing this, i'd see list of recorded usernames , when click on them, it'd show me respective analytics.
but nothing happening.
any idea if doing wrong?
thanks
yep, create custom report:
- log ga , go "
customization
" @ top, , click "+ new custom report
". - select metrics want see custom report e.g. sessions, pageviews, etc.
- select dimension want see. in case,
user name
. - click save.
you should see data.
again, urge use user id rather user name.
Comments
Post a Comment