react-code-dataset / wp-calypso /client /lib /analytics /utils /is-url-excluded-for-performance.js
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
import debug from './debug';
// For better load performance, these routes are excluded from loading ads.
const excludedRoutes = [ '/log-in' ];
/**
* Are tracking pixels forbidden from the given URL for better performance (except for Google Analytics)?
* @returns {boolean} true if the current URL is excluded.
*/
export default function isUrlExcludedForPerformance() {
const { href } = document.location;
const match = ( pattern ) => href.indexOf( pattern ) !== -1;
const result = excludedRoutes.some( match );
debug( `Is URL Excluded for Performance: ${ result }` );
return result;
}