Skip to content

Login & Sign Up

login and sign_up are GA4 recommended events. Implementing them correctly gives you authentication funnel data — how many users register vs. sign in, which authentication methods are most popular, and where in the funnel authenticated users convert differently from anonymous users.

More importantly, login is the event where you should set user_id — GA4’s mechanism for cross-device and cross-session user identification.

Fire login after a successful authentication — after the server confirms the credentials are valid and the session is established. Not on form submission, not on button click — after success.

// After successful authentication response
dataLayer.push({
event: 'login',
method: 'email', // how the user authenticated
user_id: '12345' // hashed or anonymized user identifier
});

The login event is your opportunity to push user properties to GA4 — attributes that should persist across the user’s session and inform your audience segmentation.

dataLayer.push({
event: 'login',
method: 'google',
user_id: 'hashed_user_42813',
// User properties — these persist in GA4 as user-scoped dimensions
user_type: 'returning_customer',
user_loyalty_tier: 'gold',
account_created_year: '2022',
has_active_subscription: true
});
Event Schema login
Parameter Type Required Description
event string Required Must be "login"
method string Optional Authentication method. Recommended values: email, google, facebook, apple, sso.
user_id string Optional Hashed user identifier. Never use PII. Must be consistent across sessions and devices.

Fire sign_up after a successful account creation — when the new account has been confirmed on the server, not when the user clicks Submit.

// After successful account creation
dataLayer.push({
event: 'sign_up',
method: 'email', // registration method
user_id: 'hashed_user_new_98765'
});
dataLayer.push({
event: 'sign_up',
method: 'email',
user_id: 'hashed_user_new_98765',
// Optional: registration context
referral_source: 'friend_invite',
newsletter_opted_in: true,
account_type: 'personal'
});
Event Schema sign_up
Parameter Type Required Description
event string Required Must be "sign_up"
method string Optional Registration method. Recommended values: email, google, facebook, apple.
user_id string Optional Hashed identifier for the newly created user.

The user_id parameter on login and sign_up is special in GA4. When you configure a GA4 Event tag in GTM to send a user_id parameter, GA4 uses it to stitch together sessions and events across devices.

For GA4 to actually receive and use the user_id, you need to configure the GA4 Configuration tag (or Google Tag) to read it. Add a user_id parameter to the configuration tag that reads from a Data Layer Variable — not just as an event parameter on the login event.

// GTM Data Layer Variable: DLV - user_id
// Path: user_id
// This variable should be read by the GA4 Configuration tag's "user_id" field
// as well as included in the login/sign_up event parameters

Use consistent, lowercase values for the method parameter:

// Standard authentication methods
method: 'email'
method: 'google'
method: 'facebook'
method: 'apple'
method: 'twitter'
method: 'microsoft'
method: 'sso' // enterprise SSO
method: 'magic_link' // passwordless link
method: 'phone' // SMS/phone verification

Both events follow the same pattern:

  1. Create a Custom Event trigger for login and another for sign_up.
  2. Create a Data Layer Variable for method and user_id.
  3. Create GA4 Event tags for each event, mapping method and user_id as event parameters.
  4. In your GA4 Configuration tag, also map user_id to the GA4 user_id field.

Pushing PII. Never push email addresses, names, or readable user IDs. Use a server-generated hash.

Firing on form submission instead of success. If authentication fails (wrong password), the event should not fire. Fire only after server confirmation.

Not setting user_id on login. If a user signs in and you don’t push their user_id, you lose the cross-session stitching that makes user-level analysis possible in GA4. Login is the moment to set it.

Different user_id formats between devices. The user_id must be the same string across all devices and sessions for the same user. If your web app generates user_42813 but your mobile app generates 42813, they won’t stitch in GA4.