Skip to content

Instantly share code, notes, and snippets.

@chavesm
Last active April 10, 2021 09:56
Show Gist options
  • Save chavesm/dfd1a48591fce4acddf9d6b663f49f94 to your computer and use it in GitHub Desktop.
Save chavesm/dfd1a48591fce4acddf9d6b663f49f94 to your computer and use it in GitHub Desktop.
How to Track Login Events with Google Tag Manager

How to Track Login Events with Google Tag Manager

The Trigger

  1. Create a Form Submission trigger. Name it something like Login.

  2. Select trigger fires on Some Forms.

  3. Add a Page URL condition that contains some text that's contained in the URL of your login form.

For example, my GA test site's login URL is https://streetphotography.blog/my-account/. So, I used the text my-account for the trigger's condition.

GTM Login Trigger

The Tag

  1. Create a Google Analytics Universal Analytics. Name it something like Login.

  2. Set Track Type to Event.

  3. Set Category to form.

  4. Set Action to submit or login.

  5. Set Label to Log in.

  6. If you have a GA settings variable for your tracking ID, select it under Google Analytics Settings.

  7. Under Firing Triggers add the Login trigger you created earlier.

GTM Login Tag

Variable Used in the Tag Example (optional)

Just for completeness, here's the GA settings variable I referenced in my tag.

GA Settings Variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment