AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4K members online now
4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Implementing Event tracking code for successful logged in users & for login failed users

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello ,

I am trying to track number of successful & failed login attempts with Universal analytics. I need to check for authenticated & anonymous users.The authenticated users are stored in database. so how i can fetch and define Custom variable for each of those users stored in database. 

    I tried this code , but not working.

 

ga('set', '&uid', {{USER_ID}});
ga('send', 'event', 'Login and Signup', 'Login Success', '{{Facebook, Twitter or Onsite}}', {
'dimension1': '{{USER_ID}}', //For seeing User-ID (If Privacy Policy Supports)
'dimension2': 'Yes', //Cohort for Registered User
'dimension3': '{{Facebook, Twitter or Onsite}}', //Dimension for Login/Signup Source
'metric4': '1', //Metric for Logins
});

 

Can you help me please??  I am grateful for your answers......

Re: Implementing Event tracking code for successful logged in users & for login failed users

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭
Hi Vijay,

Do you want to track the number of successful/unsuccessful login attempts or segment your site visitors into logged-in vs. anonymous?

If the former, you don't need custom dimensions as far as I can tell, instead you can track those via events and then setup those events as goals to be able to see the %.
Alternatively, if you have specific pages for successful and unsuccessful logins, then you can use their URLs in your goal setup.