We would like to filter out (from our monthly GA reporting stats) those site visits where a user lands on our marketing domain and then immediately clicks our "Member Login" hyperlink (simple anchor tag) to navigate to our members-only site.

Our members-only domain is a subdomain (i.e., members.example.com) of the primary marketing (www.example.com) domain.


The solution:

  1. Create a custom event, call it using the onclick attribute of the anchor tag (of the outbound link), as per this article, using the JavaScript code below

  2. Create an exclusion for that event using advanced segments

    var trackOutboundLink = function(url) {
       if (typeof ga !== 'undefined') {
         ga('send', 'event', 'outbound', 'click', url, {
           'transport': 'beacon',
           'hitCallback': function(){document.location = url;}
       } else {
         console.log("Google analytics object was not found!");
    jQuery(function() {
       var url = "https://members.example.com";
       jQuery("a[href *= 'members.example.com']").on('click', function() {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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