Analytics
5K members online now
5K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

User tracking in Google Analytics

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi All,

 

   I'm trying to track user session with Google Analytics + Liferay. Configured Liferay server to use google analytics. When user logs in, it is showing active users count correctly but unable to find which user is logged in and what pages user visited.

 

  In Liferay modified portal_normal.vm file, added below lines

 

var pageTracker = _gat._getTracker("UA-12345678-3");
		pageTracker._trackPageview();
		console.log('Inside pageTracker -> portal_normal getAccount:'+pageTracker._getAccount());
				
		ga('create', 'UA-12345678-3', 'auto', {
		  userId: "User1"
		});
		ga('set', 'userId', 'User1');
		ga('send', 'pageview');

when I login into my portal application, it is not showing any error and it is executing above code from .vm file. The active user count is updating correctly in google analytics page. But unable to find user session ("User1") and what page user is navigated in google analytics. It is not even showing user name "User1".

 

  Can anyone please let me know, how to resolve this issue?

 

  Thanks in advance.

 

Regards,

Sharath Karnati

1 Expert replyverified_user

Re: User tracking in Google Analytics

Top Contributor
# 2
Top Contributor
Hi Sharath,

you are using classic and universal codebase at the same time which needs to be edited. User Id feature only accepts Universal and is only applicable inside a specific type of user id enabled view. Once you set this up you cannot really expose this user id unless you send it as a custom dimension value at the same time.

So please follow the steps:
1) Migrate your implementation to Universal only code (use full GA tracking code)
2) set both user Id and custom dimension with the value of user id)
3) create the user id enabled view
4) create a custom report which will provide info on the custom dimension and metrics you need in reporting

Hope this helps!

Kind regards,
Zorin
Web analyst @ escapestudio.net