March 11, 2021

How to Exclude Login Traffic from Google Analytics

When your SaaS platform has a login on the homepage, it can be very easy to confuse organic ToFu website traffic with users who are only visiting your homepage to log in to their accounts. 

Over time, that traffic can amount to a real misunderstanding of how organic visitors are actually interacting with your site. But, if you filter out login traffic from your website analytics, you can ensure that you're accurately tracking user behavior and gain higher visibility into which website visits are users versus actual organic traffic. 

Setting Up Google Analytics

To exclude login traffic, you’ll need to be using Google Analytics in tandem with Google Tag Manager. 

To start, you need to have at least two views set up in your Google Analytics account. The first will be completely unprocessed data with no filters. The second view should be used to filter out your internal team members’ IPs. You'll interact with your site far differently than anyone else who visits your site and therefore, you'll need to filter out that traffic.

Additionally, add a third filter that will exclude all traffic from people coming to the site only to log in. Once again, we're assuming that these people will be interacting with your site differently than general visitors would. They're not looking for new information, they already have all of the info they need from your site.

Once you've created a new view, you'll need to create a filter. Google Analytics has a variety of predefined filters that can be used to filter out traffic based on criteria such as your IP address or sub-directories. For this use case, you'll need to create a custom filter based on a custom event. This event will be fired by a tag/trigger combination you'll establish in Google Tag Manager.

Download the Essential Guide to Demand Generation

Creating a Tag and Trigger in Google Tag Manager

The first step inside GTM is to create a container for your website. Once that's in place, it's time to create the trigger/tag combination. Essentially, the trigger's role will be to wait for a defined action to happen on your website and then immediately fire an associated tag to mark that the action occurred. You can create a trigger to fire based on several criteria, two of which are especially relevant for this solution.

  • Page View: When a user goes to log in to their account, they'll visit a specific page. That page will have a specific query string in the URL, most often we see this end in “/login.”  In our experience, enabling the trigger to fire on a page view has proved to be the most reliable. 
  • Click Event: This trigger type will fire on either all clicks or some clicks. For actual visibility, use some clicks and define the click based on the query string associated with your login link. This is the second most reliable trigger, but it fails to account for non-users who might have accidentally clicked “log in”, but don't complete the action.

Once the trigger is established, it's time to link an associated tag. First, you need to create a Google Analytics Google Tag Manager variable. Click “variables” in the left-hand vertical menu of Google Tag Manager. Then create a new user-defined variable. 

Name your variable, and then edit the variable configuration. Select “Google Analytics Settings” from the options for variable type. Then insert the filtering view tracking ID from Google Analytics.

Next, select “Tags” from the left-hand vertical menu and create a Universal Analytics tag with the track type set to “event.” Fill in a label on the tag, like “Exclude Login traffic,” and select the variable you just made from the “Google Analytics Settings” drop-down. This tag will be tied directly to your Google Analytics account and configured with a defined event category, event action and event label.

It's very important that the fields included in this tag are specific to the event because we will use one of these three to link the tag back to the custom event Google Analytics. Finally, to make the tag fire, choose the trigger that you just created. The final tag should look something like this:

Download the Essential Guide to Demand Generation

Filtering Out Login Traffic

Next, you're going to head back into Google Analytics and actually create the filter to exclude login traffic. To do that, navigate to “Admin,” “View Settings,” “Filters” and click “Add Filters.” Create a new filter, with the filter type set to “exclude” and the filter field set to either “event category,” “action,” or “label.” It doesn't matter which of these you chose, but make sure that the naming convention you enter in the filter pattern explicitly matches what you've defined it as in Google Tag Manager. This will link the filter to the tag and finally back to the trigger. 

Once this is set up, it's good practice to head to your real-time analytics tab in Google Analytics to check that the event is firing properly. It can also be beneficial to create another view that will capture the opposite data (i.e. people who aren't logging in) so that you can compare the accuracy of your new Google Analytics views against the original, unprocessed data. If each event appears to be working the way you want it to, head back to Google Tag Manager and submit the changes in the upper right-hand corner to officially publish your changes. 

New call-to-action

This post was originally published May 1, 2017.

Rider Gordon

Rider Gordon is the Lead Search and Paid Social Advertising Strategist at New Breed. In his free time, he likes to ski, fly fish and brew beer.


Ready to jumpstart your acquisition, retention and expansion efforts?

Request Assessment