• Courses
    • Paid courses
    • Course bundles
    • Free courses
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • About
    • About
    • Contact
  • Login
  • Courses
    • Paid courses
    • Course bundles
    • Free courses
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • About
    • About
    • Contact
  • Login

March 24, 2025

Track Signups and Logins with Google Analytics 4 and Google Tag Manager

Updated: March 24th, 2025

If your website or e-commerce store has a login feature (for your visitors/customers), you should definitely measure that. Since the tool of choice on my blog is Google Analytics 4, I’ll show you several options on how to track logins with Google Tag Manager and send them to Google Analytics. Oh, and let’s not forget signups too!

Instead of trying to write some compelling introduction that should get you hooked, let’s get down to business and learn how to implement a login tracking setup.

Subscribe and Get the Ebook - working with reports in ga4

Table of Contents

Here’s what you will learn in this article

  • A quick word about the User ID feature in Google Analytics
  • Why should you track logins and signups?
  • There is no silver bullet: the login/signup tracking method depends on your site
    • Method #1. Plugins in popular CMS
    • Method #2. Track when a success message appears
    • Method #3. Cooperate with developers
      • #3.1. What about logins and errors?
    • Other possible indicators that the user has just logged in/signed up
  • Where to find login/signup data in Google Analytics 4 reports?
    • Events Reports
    • Explorations
    • Example of a segment “Logged in users”
  • Naming convention
  • Final words

 

A quick word about the User ID feature in Google Analytics

This blog post will focus more on sending the login and signup data as events to Google Analytics. But, if you want to implement a user ID feature in GA4, I have a separate guide dedicated to that (it’s a long one but offers many options).

Google Tag Manager Ebook Bundle

 

Why should you track logins and signups?

You might have more reasons to do this, but here are the most common ones.

#1. Ability to segment visitors who are already your users.

Here’s a situation: you are trying to analyze how visitors behave on your website’s homepage. Unfortunately, most do not click on that almighty Signup now button. With login tracking, you could possibly find out that X% of your visitors who land on the homepage are existing users who want to log in.

Of course, you can segment such traffic not only with the login event in GA. There might be other options (like “exclude visitors who visit the /my-account/ area). There are different ways to skin a cat. I just wanted to show you different possibilities.

#2. Ability to identify problems/ errors in the login/ signup process.

If you can track not only the positive action (successful login/signup) but also errors, you can identify where your visitors/users struggle and possibly initiate a change that eventually will increase the conversion rate (or make the user experience better).

#3. Ability to identify traffic sources that drive the most signups.

Signup is a conversion, and you must track that with your analytics (and marketing) tools to:

  • Better understand which traffic sources work the best
  • Measure the effectiveness of your marketing campaigns

 

There is no silver bullet: the login/signup tracking method depends on your site

There is no standard out-of-the-box way to track logins or signups with Google Tag Manager. The method you choose depends on how the login/signup process works. Here are some examples.

 

Method #1. Using popular CMS? Check for the GTM plugin

Suppose you are dealing with a popular content management system (CMS) (or e-commerce platform). In that case, you can install a Google Tag Manager plugin/extension that might also support login/registration tracking.

For example, WordPress.

If a website uses WordPress as a Content Management System, you can install a plugin called GTM4WP. Once you do that and enter the GTM container ID (watch this video from 4:30), you can go to Settings > Google Tag Manager > Events (that’s happening in the WordPress admin panel) and enable checkboxes related to login and registration.

Save the changes in the plugin and check if it is pushing login/registration data to the Data Layer. Enable the GTM preview mode, log in as a user to your site (via frontend, not backend), and you should see an event in the preview mode.

If yes, that’s a good sign. Then create a Custom Event Trigger (go to Triggers > New > Custom Event) and enter the following settings (“Event name” field is case-sensitive):

Remember that gtm4wp.userLoggedIn event name is specific to that particular GTM plugin on WordPress. If you use a plugin on another platform, the event name will differ (in your custom event trigger).

Finally, create a GA4 tag that will fire when the user logs in and send the event to Google Analytics. In GTM, go to Tags > New > Google Analytics > Google Analytics: GA4 Event and enter the following settings. Assign the Custom Event Trigger we have previously created.

P.S. In this article, I presume that you have already installed GA4 via Google Tag Manager. If not, read this guide first.

What about tracking registration/signups in WordPress with Google Tag Manager? Repeat the same process as with the login (but with a bit different settings):

  • Create a custom event trigger with a different event name (that you’ll see in the GTM Preview mode after successful registration)
  • Create a new GA4 event tag.
  • Assign the custom event trigger to the GA4 tag mentioned above.

Remember: the naming convention is up to you (or what is already being used by a company). I am here to give some tips/options. If you want to name events differently, feel free to do so.

When you save the tag(s), you must test (in the preview mode + check the GA4 debugview).

In a nutshell, the process will look like this:

  • Refresh the preview mode.
  • Register as a new user (a new event related to the registration or login will appear in the preview mode). Click it.
  • Check if the GA registration tag has fired on that data layer event (in the preview mode)
  • Then go to GA and check if the event is visible in Realtime > Events report

 

Method #2. Track when a success message appears

If a GTM plugin is unavailable in your case, you might want to check this: maybe a success message is displayed on a screen when the user logs in or signs up.

If yes, you could use the Element Visibility trigger in Google Tag Manager. I have a video tutorial where I show how to track forms with it. It’s an older tutorial, but you can still get the idea of the setup.

However, remember that you will likely need to get familiar with CSS Selector basics.

 

Method #3. Cooperate with developers

Regarding login tracking with Google Tag Manager, I usually cooperate with developers and ask them to push info to the Data Layer about the login or signup.

Together with those data layer events, I also ask developers to pass more info, for example:

  • User ID
  • Login/Signup method (email, Google login, LinkedIn login, etc.)
  • Login/signup errors (together with actual error messages (but without personal info))

If you are not familiar with Data Layer and dataLayer.push, read these two resources first (otherwise, you might feel lost):

  • Data Layer Tutorial
  • dataLayer.push with examples

Speaking of successful registrations, you could ask a developer to activate a code that looks like this:

window.dataLayer = window.dataLayer || [];
 window.dataLayer.push({
      'event' : 'registration',
      'authentication_method' : 'email',
      'user_id' : 'abc123' //this should be replaced with an actual ID
 });

Remember that your developer’s code must dynamically replace some values (e.g., user_id must be replaced with an actual ID of a user who has just registered).

Then, you need to create a custom event trigger (Triggers > New > Custom Event) and enter registration (because that’s the “event” in the dataLayer.push).

If you also want to send the authentication_method as an event parameter, you can create a Data Layer Variable with the following settings:

In this example, I will skip the user_id field. You can learn how to configure it here.

Finally, create a Google Analytics 4 tag. In GTM, go to Tags > New > Google Analytics > Google Analytics: GA4 Event and enter the following settings:

When you save the tag, you also must test it (in the preview mode + check the GA4 DebugView reports). In a nutshell, the process will look like this:

  • Refresh the preview mode
  • Register as a new user (a registration event will appear in the preview mode). Click it.
  • Check if the GA4 registration tag has fired on that data layer event
  • Then go to the Google Analytics 4 DebugView and check if the event is reported there

 

#3.1. What about logins and errors?

If you want to track logins, then you would need to ask the developer for another dataLayer.push that could look like this (reminder: these are just examples. You are free to name the parameters and their values differently if you wish.):

window.dataLayer = window.dataLayer || [];
 window.dataLayer.push({
      'event' : 'login',
      'authentication_method' : 'email',
      'user_id' : 'abc123' //this should be replaced with an actual ID
 });

Then repeat the same process as you did with the registration (create a trigger for the login event, data layer variables (if the push contains some new vars), and a tag).

Want to track login/signup errors? Sure. Once again, you could ask a developer to push something like this:

window.dataLayer = window.dataLayer || [];
 window.dataLayer.push({
      'event' : 'website_error',
      'error_type' : 'login error', // or registration error
      'error_message' : 'error text' //this should be replaced with an actual message
 });

And once again, create Custom Event Triggers, Data Layer Variables, and tags, and send this data to GA.

 

Other possible indicators that the user has just logged in/signed up

The methods mentioned above are the most common (based on my experience). If none are possible in your project, try to be creative and play a detective.

You need to find a way to identify that a visitor has just logged in (or sign up). Here are some ideas.

  • Idea #1. The page URL (after the visitor signed up) may be decorated with a parameter ?registered=true that is visible only once after the successful registration. This situation will probably be super rare, but maybe you’re lucky.
  • Idea #2. Maybe a user who has just registered is always redirected to some onboarding page (with tutorials, etc.)? If the onboarding page’s URL is unique, you could use that as a trigger condition. For example, Page Path contains /welcome/
  • You can find more inspiration on how to track logins by reading this form tracking guide.

 

Where to find login/signup data in Google Analytics 4 reports?

Just collecting the login/ signup data doesn’t give you the complete picture. You need to understand how to increase the number of active users on your website.

You can find this data in two places: the Events report and the Explorations. Below, I will show you several examples of how/where to find/use the data.

Events report

Navigate to Reports >Engagement > Events. Here, you would see the list of all events, among which login should also be present.


However, you can only see the general event data, like event count, total users, etc.

 

Explorations

The second option is in the Explore section. Head over to the Explore section and select Blank Exploration.

Now, add Event Name as a dimension in the report. Let’s go ahead and add Event Count, Sessions, and Events per session as metrics.


Now, we need to make sure the details get populated in the table on the right. To do this, make sure to add Event name dimension to the Rows section and the respective metrics in the Columns section, as in the screenshots below:

The resulting table should look like this.

Now, let’s say we wanted to dive deeper into the report. Suppose we wanted to find the most preferred method for users to log into their accounts. To do this, you would need to send a datalayer variable called method. This variable would capture the login method used, which can then be used in your exploration reports.

method is a built-in dimension, so you can directly access it in your reports without having to create a custom dimension.

First, we need to add a filter to the report to get to the login methods. Let’s add a filter such that Event Name exactly matches login.


Now, add a secondary dimension to the report. This should be the Method dimension, which Google Tag Manager picks up from the datalayer when a user logs in. Add the dimension as in the screenshot below:


The final report should look like this:


Intelligent use of the datalayer, my friend!

 

See the data of users who have logged in

If you are sending a user ID with all events to GA4 (when a user has logged in), you can narrow down the data set in your standard reports and see data only of users who have signed in.

Let’s say that you want to get data only of those sessions where the users have signed in with User ID? You can create a segment in explorations.

Go to Explore > Blank and then click a plus sign in the Segments section.

add segment in google analytics 4

Then enter the following condition: Signed in with user ID is Yes.

signed in with user id google analytics 4

This means it will include data of all sessions where a user was signed in and at least one event containing the user_id parameter.

Save the segment, and it will be automatically applied to the report. The next step is to configure the dimensions and metrics. Let’s say you want to see the top traffic sources of users who log in.

In the dimensions section, select “Session source/medium” (by clicking the Plus icon). In the metrics, add sessions and Total users). If you want to learn more about GA4 explorations and how to work with them, read this guide.

Then double-click all those metrics and dimensions, and the final report will look like this:

Subscribe and Get the Ebook - Real Book Img - GTM for Beginners

Naming convention

If you are unfamiliar with naming conventions, I have an in-depth guide here. It also makes sense to track when the registration starts. Regarding GA4, Google recommends that the login event be called login (obviously). The registration event could be called sign_up (but it’s a recommendation, not a requirement. You can name it “registration” if you want.

If you want to send a user id, it must be named user_id (learn more here).

Everything else is up to you. However, I highly recommend naming your events with all-lowercase letters + use underscores. For example, “sign_up”, not “sign up”.

 

Track Logins with Google Tag Manager and GA4: Final words

That was the general idea of tracking logins and signups with Google Tag Manager and sending that data to Google Analytics 4. I usually use a plugin or cooperate with developers and ask them to push some data to the Data Layer.

First, I play around with the login/registration process (to understand better how it works) and then plan out all the events I could track (and that would bring value). You could list all the possible events and their values in a spreadsheet. This will help you select the most logical naming convention.

Then, the actual implementation depends on your capabilities and the website you’re working with. After reading this blog post, I hope you have managed to select the correct login tracking method.

Julius Fedorovicius
In Google Analytics Tips Google Tag Manager Tips
7 COMMENTS
Suzy
  • Sep 23 2021
  • Reply

Is it possible to track user IDs from 2 different authentication platforms under the same GA property? For example in this scenario: subdomain A uses X to authenticate users and subdomain B uses Y to authentication users. Subdomains A and B are integrated under the same GA property. Is it possible to track users from both under the same User ID report? Thank you!

    Julius Fedorovicius
    • Sep 23 2021
    • Reply

    As long as you are using the same GA property on both subdomains and the user ID of user X matches on both subdomains, then your user ID tracking will work fine.

Kasper
  • Oct 1 2021
  • Reply

Would it be useful to ask a developer to push the login state on every page load with a variable like this: visitorLoginState: "Logged Out" / "Logged In".

Or would it be better to set a first party cookie with the state of the user after logging in or signing out?

What would be your preferred method?

    Julius Fedorovicius
    • Oct 8 2021
    • Reply

    I would ask a developer to push on every pageview

      Charlotte
      • May 10 2023
      • Reply

      If you are collecting the user_id with every pageview, an extra 'loginState' event would be unnecessary right? As you can use the Signed in with User ID parameter?

Dina
  • May 25 2023
  • Reply

Is it possible to use this to track unique user logins for a given time period? If yes, what would I need to do?

Ismael
  • Nov 23 2023
  • Reply

Hello, I am having the following problem with gtm4wp and the login event. When a user logs in, they are redirected through the Redirect plugin to a specific page. That is causing the gtm4wp.userLoggedIn event to not fire. If I disable the Redirect plugin the event fires correctly. What could be the problem?

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *


 

Hi, I'm Julius Fedorovicius and I'm here to help you learn Google Tag Manager and Google Analytics. Join thousands of other digital marketers and digital analysts in this exciting journey. Read more
Analytics Mania
  • Google Tag Manager Courses
  • Google Tag Manager Recipes
  • Google Tag Manager Resources
  • Google Tag Manager Community
  • Login to courses
Follow Analytics Mania
  • Subscribe to newsletter
Recent Posts
  • Google Tag Manager Server-Side Tagging with Stape
  • How to Preserve Ad Click IDs with Server-side Tagging
  • LinkedIn Conversions API with Google Tag Manager. The Guide.
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings