For websites that have an authentication method, login and signup tracking are critical to have implemented correctly in Google Analytics. Often, I see businesses get these metrics incorrect. They may accidentally pass the data on submit instead of validation, forget to track failed submissions, or worse yet implement a naming convention that is not human readable. Having performed hundreds of Google Analytics audits and implementations I would like to share my best practices for tracking and naming conventions for Login and Signup metrics. Once you have these correctly implemented you can monitor your authentication forms to determine when things go awry, capture lost signups through the GA/AdWords Remarketing integration, and scale with future login/signup events such as form field tracking.
I will share with you my ideal Signup/Login report and also provide code for you to pass to your developers for either Google Tag Manager or Universal Analytics.
End Result
The image below is the end result of what you will achieve by following my recommendations. Notice that all the metrics are in one report, instead of spread out in various Google Analytics Events. This report is built on the new functionality that Universal Analytics provides with Custom Metrics and Custom Dimensions. For end users, this is much easier to understand compared to the traditional metrics of Total or Unique Events. We can also download this report or use the API to pull it in sheets and easily calculate login and signup success and conversion rates.
Example of Login/Signup Done Wrong
For this post I am going to pick on one of my favorite websites Major League Soccer(MLS). Lets start by taking a looking at their login form:
MLS follows a typical login form in that it has options for both Social Authentication as well as a Onsite method. For MLS they will need to ensure they have integrations with both of these methods. This means that MLS will need to potentially interface with the Facebook and Twitter APIs to listen for the authentication success events, as well as interface with their onsite login form.
Lets take a look at what MLS is tracking using the free Google Analytics debugger for Chrome. When I login using Google the following data is returned.
MLS has some good data here, but it is far from ideal. They track more than most businesses in actually tracking the source of the login by passing ‘googleplus’ into the event action. The main issue I have with their architecture of this event is that the Event Category, which is primarily used to categorize events for searching is ‘Gigya showScreenSet’. The average Google Analytics user will have no idea what this means. It should contain something about Login or Signup.
MLS is also missing some other key data points. When users signup through a Social connection, a pop usually occurs informing the user of what data they are authorizing your website to collect or manage from your social account such as: Email Address, Profile Info, Friends, and/or contacts. Users may feel uncomfortable if you ask for to much, especially access to post directly to their account and abandon the signup process. The click on the social buttons that open the authentication widget are not being tracked at all. MLS is thus unable to calculate what percentage of users attempt to login or signup and abandon.
In addition MLS is not capturing Failed Logins and appears to have difficulty differentiating a social login vs. a social signup. This is actually very common for the majority of solutions that exist for social authentication, in that they do not allow you to differentiate a user that is registering for the first time vs. someone that is a returning user and logging in. Te solution for this is to interface with your database and developers to pass back if it was a signup or login from your systems instead of Facebook or Twitters.
Login and Signup Naming Conventions
Lets get to it. I have implemented dozens of login and signup metrics and have had learned along the way what works best. Here is my recommended naming metrics and naming conventions for Login and Signup. The benefits of this is that they are easy to understand for average Google Analytics Users, they will pass all the information into one report, and they provide the ability to calculate conversion, success, and failure rates.
Signup Success
- Event
- Category = Login and Signup
- Action = Signup Success
- Label = <Method> //Facebook, Twitter, Onsite
- Non-Interaction = False
- Custom Dimensions
- Name = User ID (Hit Scoped)
- Name = Registered User
- Index = 2
- Scope = User
- Value = Yes
- Name = Login/Signup Source
- Index = 3
- Scope = Hit
- Value = <Method> //Facebook, Twitter, Onsite
- Custom Metrics
- Name = Signup Successes
- Index = 1
- Value = 1
- Minimum Value = 1
- Maximum Value = 1
- Formating Type = Integer
- Name = Signup Successes
Signup Fail
- Event
- Category = Login and Signup
- Action = Signup Fail
- Label = <Method>: <Validation Error> //e.g. Onsite: Invalid E-Mail or Facebook: Not Authorized
- Non-Interaction = False
- Custom Dimensions
- Name = Login/Signup Source
- Index = 3
- Scope = Hit
- Value = <Method> //Facebook, Twitter, Onsite
- Name = Login/Signup Source
- Custom Metrics
- Name = Signup Fails
- Index = 2
- Value = 1
- Minimum Value = 1
- Maximum Value = 1
- Formating Type = Integer
- Name = Signup Fails
Signup Submit
- Event
- Category = Login and Signup
- Action = Signup Submit
- Label = <Method>
- Non-Interaction = False
- Custom Dimensions
- Name = Login/Signup Source
- Index = 3
- Scope = Hit
- Value = <Method> //Facebook, Twitter, Onsite
- Name = Login/Signup Source
- Custom Metrics
- Name = Signup Submit
- Index = 3
- Value = 1
- Minimum Value = 1
- Maximum Value = 1
- Formating Type = Integer
- Name = Signup Submit
Login Success
- Event
- Category = Login and Signup
- Action = Login Success
- Label = <Method> //Facebook, Twitter, Onsite
- Non-Interaction = False
- Custom Dimensions
- Name = User ID (Hit Scoped)
- Name = Registered User
- Index = 2
- Scope = User
- Value = Yes
- Name = Login/Signup Source
- Index = 3
- Scope = Hit
- Value = <Method> //Facebook, Twitter, Onsite
- Custom Metrics
- Name = Login Successes
- Index = 4
- Value = 1
- Minimum Value = 1
- Maximum Value = 1
- Formating Type = Integer
- Name = Login Successes
Login Fail
- Event
- Category = Login and Signup
- Action = Login Fail
- Label = <Method>: <Validation Error> //e.g. Onsite: Invalid E-Mail or Facebook: Not Authorized
- Non-Interaction = False
- Custom Dimensions
- Name = Login/Signup Source
- Index = 3
- Scope = Hit
- Value = <Method> //Facebook, Twitter, Onsite
- Name = Login/Signup Source
- Custom Metrics
- Name = Login Fails
- Index = 5
- Value = 1
- Minimum Value = 1
- Maximum Value = 1
- Formating Type = Integer
- Name = Login Fails
Login Submit
- Event
- Category = Login and Signup
- Action = Signup Submit
- Label = <Method>
- Non-Interaction = False
- Custom Dimensions
- Name = Login/Signup Source
- Index = 3
- Scope = Hit
- Value = <Method> //Facebook, Twitter, Onsite
- Name = Login/Signup Source
- Custom Metrics
- Name = Login Submit
- Index = 3
- Value = 1
- Minimum Value = 1
- Maximum Value = 1
- Formating Type = Integer
- Name = Login Submit
Installation
Now that we have our naming conventions, we need to implement the code on our website to make it happen. Below I have provided both Google Tag Manager and direct Universal Analytics code to match either implementation you may have.
Google Tag Manager Installation
If you are using Google Tag Manager you should work with your developer to have the following dataLayer pushes implemented upon submit, fail and success. At the end, you will also find a Google Tag Manager Container import file that creates the tags for you.
Signup Success
dataLayer.push({ 'event': 'user-signup-success', 'method': '<facebook|google|onsite>', 'user-id': '<user-id>' //unique non-personally identifiable id });
Signup Fail
dataLayer.push({ 'event': 'user-signup-fail', 'method': '<facebook|google|onsite>', 'validation-error': '<reason>' //e.g. Invalid E-Mail, Password Mismatch, Not Authorized });
Signup Submit
dataLayer.push({ 'event': 'user-signup-submit', 'method': '<facebook|google|onsite>' });
Login Success
dataLayer.push({ 'event': 'user-login-success', 'method': '<facebook|google|onsite>', 'user-id': '<user-id>' //unique non-personally identifiable id });
Login Fail
dataLayer.push({ 'event': 'user-login-fail', 'method': '<facebook|google|onsite>', 'validation-error': '<reason>' //e.g. Invalid E-Mail, Password Mismatch, Not Authorized });
Login Submit
dataLayer.push({ 'event': 'user-login-submit', 'method': '<facebook|google|onsite>' });
Once you have these pushes implemented you can download this container file and import and merge the tags I have created for you into Google Tag Manager. Simply renamed the Google Analytics Account ID and remap any custom dimensions and metrics slots as needed.
Universal Analytics – Installation
If you are using Universal Analytics without Google Tag Manager you should work with your developer to have the following event pushes implemented upon submit, fail and success. You will just need to configure the dimension and metrics slots.
Signup Success
ga('set', '&uid', {{USER_ID}}); ga('send', 'event', 'Login and Signup', 'Signup 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 'metric1': '1', //Metric for Signups });
Signup Fail
ga('send', 'event', 'Login and Signup', 'Signup Fail', '{{Facebook, Twitter or Onsite}}: {{validation-error}}', { 'dimension3': '{{Facebook, Twitter or Onsite}}', //Dimension for Login/Signup Source 'metric2': '1', //Metric for Failed Signups });
Signup Submit
ga('send', 'event', 'Login and Signup', 'Signup Submit', '{{Facebook, Twitter or Onsite}}', { 'dimension3': '{{Facebook, Twitter or Onsite}}', //Dimension for Login/Signup Source 'metric3': '1', //Metric for Signup Submits });
Login Success
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 });
Login Fail
ga('send', 'event', 'Login and Signup', 'Login Fail', '{{Facebook, Twitter or Onsite}}: {{validation-error}}', { 'dimension3': '{{Facebook, Twitter or Onsite}}', //Dimension for Login/Signup Source 'metric5': '1', //Metric for Failed Logins });
Login Submit
ga('send', 'event', 'Login and Signup', 'Login Submit', '{{Facebook, Twitter or Onsite}}', { 'dimension3': '{{Facebook, Twitter or Onsite}}', //Dimension for Login/Signup Source 'metric6': '1', //Metric for Login Submits });
Thats it! If you run into any issues or have any questions or comments, please leave a comment below or reach out to me on Twitter @CharlesFarina.
Besides the UA is there something else that must be changed in order to make it work?
Hi Joao, you will need to create the custom dimensions/metrics scopes and slots in Google Analytics. Do you need help with this?
Actually yes, is there some guide I should follow in order to create such dimensions and metrics. I thought they were created on Google Tag Manager
Hi Charles, a short question, would you recommend to add the dataLayer.push before or after the Tag Manager Snippet?, I know that GTM recommends before but since is a “push” I wonder if that changes something.
Hi Charles, in the code ga(‘set’, ‘&uid’, {{USER_ID}}), how this USER_ID is checked for authentication. I mean someone can enter any values & hit the login button, how this USER_ID is get populated?
Hi Charles, how this USER_ID value is being set or populated? how can we define a USER_ID variable to take value from textbox in login form.
There are two primary ways this happens. My friends over at Lunametrics have a great post on how to set it: http://www.lunametrics.com/blog/2015/08/13/user-id-measuring-real-users/.
If the user ID already exists on the page, you can write a GTM variable to access it and pass it into GA
Hi Charles,
Thanks for the wonderful article! Really appreciate the example events & the resulting report visualizations that you’ve illustrated.
A small query:
In your login example, could one avoid the Custom Dimension “Login/Signup Source” and still be able to get the report in the format you have illustrated?
i.e. by specifying “Event Action” as the dimension and then adding filters Action = Signup Submitted/Success/Fail/ etc.?
Thanks,
Amar.
Hi Amar,
Yes. You could just use the event category as the primary dimension, instead of the custom dimension. That way it pulls in all the custom dimensions and metrics
Hi Charles,
Do you mind sharing the custom report? Or the dimensions and metrics that you used for the report format shown above? Thanks!
Hi William,
Sharing the custom report will not really work, because the custom dimensions and metrics would have to be setup with the exact same scope.
Here are the dimensions and metrics you should create:
Custom Metric 1: Signup Succes
Custom Metric 2: Signup Fail
Custom Metric 3: Signup Submit
Custom Metric 4: Login Success
Custom Metric 5: Login Fail
Custom Metric 6: Login Submit
Custom Dimension 1: User ID
Custom Dimension 2: Register User?
Custom Dimension 3: Regisration/Login Method
Thank you, Charles!
HI Charles,
GREAT article indeed!! Thanks a lot for your time and effort.
Is it any way possible to calculate “at what time the user logged in to the system” using GA?
hello . Is it possible with normal wordpress login?
Hello, Please share info for Mobile app both ios ans android..
Hi Charles,
Thanks for help great article , but i am having issue i have implement this step by step but still the signup no. is missing , had checked with backend , the difference is about 20 30% . what could be the reason ?