Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Analytics: Remove problematic "blacklist"/"whitelist"…
- Loading branch information
1 parent
6aa089e
commit 6a3f9e6
Showing
7 changed files
with
32 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
client/lib/analytics/utils/is-url-blacklisted-for-performance.js
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
client/lib/analytics/utils/is-url-excluded-for-performance.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
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; | ||
} |