I have a website for a web application which our company has built. Let's say the domain is https://www.example.com/

Many of our customers have bookmarked this. The navigation for the site features various URLs (all relative to https://www.example.com/). However, one of the links in the navigation is a URL to the web application login page, which resides on a subdomain, https://app.example.com/login.php

We have Google Analytics tracking code on www.example.com (but not on app.example.com).

What we're trying to do is figure out a way to exclude traffic in our stats for www.example.com if the user goes to the home page, and then immediately clicks on the application login link - in other words if the user visits https://www.example.com/ and then immediately clicks the link in the navigation that takes them to https://app.example.com/login.php.

Does anyone know if it's possible to do this?

The reason we want to do it is because it skews our statistics - for example it looks as though we get thousands of visitors to the home page of our site each day. Whereas in reality we think people have bookmarked it, go to it, and then immediately go to the login page on the subdomain.

  • Google Analytics records stats as soon as the page loads, I don't see how you could not track based on an action the user performs after the tracking info has been sent. Adding your GA tracking to your app so you can see the users full session seems like a better option to me. Oct 12, 2017 at 8:54
  • Ok thanks - so if I did add the tracking code to app.example.com how does that help me? Is there a way to filter out who just went to the home page (www.example.com) followed by the app login page (app.example.com/login.php)?
    – Andy
    Oct 12, 2017 at 9:28
  • 1
    You can use behavior flow to see paths people take through your site. Now you can see whether you are right about that. Oct 12, 2017 at 9:33

2 Answers 2


You could create a custom dimension at session level scope, set its value to Logged In (or something similar). Then create an onclick event for the link https://app.example.com/login.php and send the custom dimension along with it.

The custom dimension value Logged In could then be used to filter these visits out of the reports as the custom dimension would apply to all hits within the same session.

Custom dimensions are set at the Property level. Information for how to create them is available in the GA Help Center


Then create an onclick event and send the custom dimension along with the event. eg <a href="https://www.example.com/" onclick="ga('send', 'event', 'link', 'login', {'dimension1': 'Logged In'});">Link to login</a>

Change dimension1 to reflect the index number provided in the CD table in GA interface after you create it eg if the index no. is 15 then change it to say dimension15


  • Could you provide some more details on this? I can't see where you "create a custom dimension" - is this something done within the GA control panel, or on the site?
    – Andy
    Oct 16, 2017 at 10:02
  • I updated my answer with the further info
    – Bronwyn V
    Oct 16, 2017 at 11:14

Yes you can. Create a Event Category for External Links, Event Action : Href URL, Event Label : Label of link

Then create a Custom Report with Page Dimension with User Metrics (or what ever Metrics your want) > Create a Filter to "Exclude Event Action" that "regex matches" that "login href url" AND another Filter to "Include Page" that "regex matches" your homepage, thus the report which will exclude all events that have the login url.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.