function trackPageview(pathname, fields = {}, setPageDimensions = true) {
  let currentIsAuthResult = false;
  let currentPathname;
  ga((tracker) => {
    currentPathname = tracker.get('page');
    currentIsAuthResult = /\?auth(success|error)=/.test(tracker.get('location'));
  });

  if (setPageDimensions) {
    _ga('set', {
      location: window.location.href,
      title: getDocumentTitle(pathname),
      page: window.location.pathname,
    });
  }

  // If we're staying on the same page and just closing the modal after OAuth
  // don't track a pageview
  if (!currentIsAuthResult || currentPathname !== window.location.pathname) {
    _ga('send', 'pageview', fields);
  }
}
/**
 * Track a pageview
 * @param {String} pathname From Next Router
 * @param {Object} fields Non-persistent custom dimensions
 * @param {Bool} setPageDimensions Defaults to true, updates page-level dimensions
 */
Track a pageview
@param {String} pathname From Next Router
@param {Object} fields Non-persistent custom dimensions
@param {Bool} setPageDimensions Defaults to true, updates page-level dimensions
Track a pageview @param { String } pathname From Next Router @param { Object } fields Non - persistent custom dimensions @param { Bool } setPageDimensions Defaults to true updates page - level dimensions
function trackPageview(pathname, fields = {}, setPageDimensions = true) {
  let currentIsAuthResult = false;
  let currentPathname;
  ga((tracker) => {
    currentPathname = tracker.get('page');
    currentIsAuthResult = /\?auth(success|error)=/.test(tracker.get('location'));
  });
  if (setPageDimensions) {
    _ga('set', {
      location: window.location.href,
      title: getDocumentTitle(pathname),
      page: window.location.pathname,
    });
  }
  if (!currentIsAuthResult || currentPathname !== window.location.pathname) {
    _ga('send', 'pageview', fields);
  }
}
function trackPageview ( pathname , fields = { } , setPageDimensions = true ) { let currentIsAuthResult = false ; let currentPathname ; ga ( ( tracker ) => { currentPathname = tracker . get ( 'page' ) ; currentIsAuthResult = / \?auth(success|error)= / . test ( tracker . get ( 'location' ) ) ; } ) ; if ( setPageDimensions ) { _ga ( 'set' , { location : window . location . href , title : getDocumentTitle ( pathname ) , page : window . location . pathname , } ) ; } if ( ! currentIsAuthResult || currentPathname !== window . location . pathname ) { _ga ( 'send' , 'pageview' , fields ) ; } }
Track a pageview
 @param {String} pathname From Next Router
 @param {Object} fields Non-persistent custom dimensions
 @param {Bool} setPageDimensions Defaults to true, updates page-level dimensions
Track a pageview @param { String } pathname From Next Router @param { Object } fields Non - persistent custom dimensions @param { Bool } setPageDimensions Defaults to true updates page - level dimensions
// If we're staying on the same page and just closing the modal after OAuth // don't track a pageview