diff --git a/client/extensions/woocommerce/state/sites/promotions/README.md b/client/extensions/woocommerce/state/sites/promotions/README.md index 3d3f235c5c633..649b052b2c09c 100644 --- a/client/extensions/woocommerce/state/sites/promotions/README.md +++ b/client/extensions/woocommerce/state/sites/promotions/README.md @@ -42,7 +42,7 @@ As Promotions only exist in memory state on the client at this point, the defini ### appliesTo -The `appliesTo` object for a promotion is a complex object which describes what all the promotion can be applied to. At this point, exluded products or categories are not supported. +The `appliesTo` object for a promotion is a complex object which describes what all the promotion can be applied to. At this point, excluded products or categories are not supported. #### Example: all products. diff --git a/client/lib/analytics/sem.js b/client/lib/analytics/sem.js index 67b91f5da057d..6bb5308538e4e 100644 --- a/client/lib/analytics/sem.js +++ b/client/lib/analytics/sem.js @@ -20,7 +20,7 @@ const MAX_URL_PARAM_VALUE_LENGTH = 50; const MAX_KEYWORD_PARAM_VALUE_LENGTH = 80; const MAX_GCLID_PARAM_VALUE_LENGTH = 100; // These are the URL params that end up in the `ad_details` cookie -const URL_PARAM_WHITELIST = [ +const ALLOWED_URL_PARAMS = [ 'adgroupid', 'campaignid', 'device', @@ -58,8 +58,8 @@ function isValidOtherUrlParamValue( key, value ) { return value.length <= MAX_URL_PARAM_VALUE_LENGTH; } -function isValidWhitelistedUrlParamValue( key, value ) { - if ( -1 === URL_PARAM_WHITELIST.indexOf( key ) ) { +function isValidAndAllowedUrlParamValue( key, value ) { + if ( -1 === ALLOWED_URL_PARAMS.indexOf( key ) ) { return false; } else if ( 'utm_source' === key || 'utm_campaign' === value ) { return isValidUtmSourceOrCampaign( value ); @@ -94,7 +94,7 @@ export function updateQueryParamsTracking() { if ( searchParams ) { const validEntries = Array.from( searchParams.entries() ).filter( ( [ key, value ] ) => - isValidWhitelistedUrlParamValue( key, value ) + isValidAndAllowedUrlParamValue( key, value ) ); sanitizedQuery = new URLSearchParams( validEntries ); diff --git a/client/lib/analytics/track-affiliate-referral.js b/client/lib/analytics/track-affiliate-referral.js index 90726ca9db28d..e497af0b0bbd1 100644 --- a/client/lib/analytics/track-affiliate-referral.js +++ b/client/lib/analytics/track-affiliate-referral.js @@ -11,7 +11,7 @@ import { recordTracksEvent } from 'lib/analytics/tracks'; const referDebug = debug( 'calypso:analytics:refer' ); -const whitelistedEventProps = [ +const allowedEventProps = [ 'status', 'success', 'duplicate', @@ -54,7 +54,7 @@ export async function trackAffiliateReferral( { affiliateId, campaignId, subId, if ( response.ok ) { referDebug( 'Recording Refer platform success response.', json ); recordTracksEvent( 'calypso_refer_visit_response', { - ...pick( json.data, whitelistedEventProps ), + ...pick( json.data, allowedEventProps ), status: response.status || '', success: json.success || true, description: json.message || 'success', @@ -64,7 +64,7 @@ export async function trackAffiliateReferral( { affiliateId, campaignId, subId, referDebug( 'Recording Refer platform error response.', json ); recordTracksEvent( 'calypso_refer_visit_response', { - ...pick( json.data, whitelistedEventProps ), + ...pick( json.data, allowedEventProps ), status: response.status || '', success: json.success || false, description: json.message || 'error', diff --git a/client/lib/analytics/utils/index.js b/client/lib/analytics/utils/index.js index 721060f9efdc9..b8b99b56ddb27 100644 --- a/client/lib/analytics/utils/index.js +++ b/client/lib/analytics/utils/index.js @@ -5,7 +5,7 @@ export { default as MARKETING_COUPONS_KEY } from './marketing-coupons-key'; export { default as costToUSD } from './cost-to-usd'; export { default as hashPii } from './hash-pii'; export { default as isPiiUrl } from './is-pii-url'; -export { default as isUrlBlacklistedForPerformance } from './is-url-blacklisted-for-performance'; +export { default as isUrlExcludedForPerformance } from './is-url-excluded-for-performance'; export { default as isAdTrackingAllowed } from './is-ad-tracking-allowed'; export { default as mayWeTrackCurrentUserGdpr } from './may-we-track-current-user-gdpr'; export { default as isCurrentUserMaybeInGdprZone } from './is-current-user-maybe-in-gdpr-zone'; diff --git a/client/lib/analytics/utils/is-ad-tracking-allowed.js b/client/lib/analytics/utils/is-ad-tracking-allowed.js index ff9e98dba0139..05c523e8b171a 100644 --- a/client/lib/analytics/utils/is-ad-tracking-allowed.js +++ b/client/lib/analytics/utils/is-ad-tracking-allowed.js @@ -3,7 +3,7 @@ */ import config from 'config'; import debug from './debug'; -import isUrlBlacklistedForPerformance from './is-url-blacklisted-for-performance'; +import isUrlExcludedForPerformance from './is-url-excluded-for-performance'; import isPiiUrl from './is-pii-url'; import mayWeTrackCurrentUserGdpr from './may-we-track-current-user-gdpr'; import { getDoNotTrack } from '@automattic/calypso-analytics'; @@ -23,7 +23,7 @@ export default function isAdTrackingAllowed() { const result = config.isEnabled( 'ad-tracking' ) && ! getDoNotTrack() && - ! isUrlBlacklistedForPerformance() && + ! isUrlExcludedForPerformance() && ! isPiiUrl() && mayWeTrackCurrentUserGdpr(); debug( `isAdTrackingAllowed: ${ result }` ); diff --git a/client/lib/analytics/utils/is-url-blacklisted-for-performance.js b/client/lib/analytics/utils/is-url-blacklisted-for-performance.js deleted file mode 100644 index c4452a24de779..0000000000000 --- a/client/lib/analytics/utils/is-url-blacklisted-for-performance.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Internal dependencies - */ -import debug from './debug'; - -// For better load performance, these routes are blacklisted from loading ads. -const blacklistedRoutes = [ '/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 blacklisted. - */ -export default function isUrlBlacklistedForPerformance() { - const { href } = document.location; - const match = ( pattern ) => href.indexOf( pattern ) !== -1; - const result = blacklistedRoutes.some( match ); - - debug( `Is URL Blacklisted for Performance: ${ result }` ); - return result; -} diff --git a/client/lib/analytics/utils/is-url-excluded-for-performance.js b/client/lib/analytics/utils/is-url-excluded-for-performance.js new file mode 100644 index 0000000000000..9ddf33d15e3c6 --- /dev/null +++ b/client/lib/analytics/utils/is-url-excluded-for-performance.js @@ -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; +}