Skip to content

Filter AB Tests Props - #4403

Merged
mxdvl merged 6 commits into
mainfrom
mxdvl/filter-ab-tests
Mar 28, 2022
Merged

mxdvl merged 6 commits into
mainfrom
mxdvl/filter-ab-tests

Conversation

@mxdvl

@mxdvl mxdvl commented Mar 25, 2022

Copy link
Copy Markdown
Contributor

What does this change?

Filter out AB Test Props

Why?

Because we can limit the amout of props passed.
Closes #4190

Before

{
  "abTestSwitches": {
    "anniversaryHeaderSvg": true,
    "prebidAppnexusUkRow": true,
    "commercialMetrics": true,
    "prebidTrustx": true,
    "scAdFreeBanner": false,
    "prebidPermutiveAudience": true,
    "compareVariantDecision": false,
    "enableSentryReporting": true,
    "lazyLoadContainers": true,
    "adFreeStrictExpiryEnforcement": false,
    "liveblogRendering": true,
    "remarketing": true,
    "fetchNonRefreshableLineItems": true,
    "registerWithPhone": false,
    "targeting": true,
    "remoteHeader": true,
    "extendedMostPopularFronts": true,
    "slotBodyEnd": true,
    "prebidImproveDigitalSkins": true,
    "emailInlineInFooter": true,
    "showNewPrivacyWordingOnEmailSignupEmbeds": true,
    "facebookTrackingPixel": true,
    "iasAdTargeting": true,
    "extendedMostPopular": true,
    "ampContentAbTesting": true,
    "prebidAnalytics": true,
    "prebidCriteo": true,
    "puzzlesBanner": true,
    "abSpacefinderOkrMegaTest": false,
    "imrWorldwide": true,
    "acast": true,
    "twitterUwt": true,
    "prebidAppnexusInvcode": true,
    "a9HeaderBidding": true,
    "prebidAppnexus": true,
    "enableDiscussionSwitch": true,
    "standaloneCommercialBundle": true,
    "prebidXaxis": true,
    "stickyVideos": true,
    "interactiveFullHeaderSwitch": true,
    "discussionAllPageSize": true,
    "prebidUserSync": true,
    "audioOnwardJourneySwitch": true,
    "mobileStickyPrebid": true,
    "externalVideoEmbeds": true,
    "simpleReach": true,
    "carrotTrafficDriver": true,
    "sentinelLogger": true,
    "geoMostPopular": true,
    "weAreHiring": true,
    "relatedContent": true,
    "thirdPartyEmbedTracking": true,
    "prebidOzone": true,
    "ampAmazon": true,
    "abCommercialLazyLoadMargin": true,
    "prebidAdYouLike": true,
    "mostViewedFronts": true,
    "abSignInGateMainControl": true,
    "ampPrebid": true,
    "googleSearch": true,
    "brazeSwitch": true,
    "consentManagement": true,
    "commercial": true,
    "redplanetForAus": true,
    "prebidSonobi": true,
    "idProfileNavigation": true,
    "confiantAdVerification": true,
    "discussionAllowAnonymousRecommendsSwitch": false,
    "scrollDepth": true,
    "permutive": true,
    "comscore": true,
    "webFonts": true,
    "prebidImproveDigital": true,
    "ophan": true,
    "crosswordSvgThumbnails": true,
    "prebidTriplelift": true,
    "weather": true,
    "commercialOutbrainNewids": true,
    "abSignInGateMainVariant": true,
    "abAdblockAsk": true,
    "prebidPubmatic": true,
    "serverShareCounts": false,
    "autoRefresh": true,
    "enhanceTweets": true,
    "prebidIndexExchange": true,
    "prebidOpenx": true,
    "prebidHeaderBidding": true,
    "idCookieRefresh": true,
    "sharingComments": true,
    "discussionPageSize": true,
    "smartAppBanner": false,
    "boostGaUserTimingFidelity": false,
    "historyTags": true,
    "mobileStickyLeaderboard": true,
    "surveys": true,
    "remoteBanner": true,
    "emailSignupRecaptcha": true,
    "prebidSmart": true,
    "inizio": true
  },
  "pageIsSensitive": false,
  "isDev": false
}

After

{
  "abTestSwitches": {
    "abSpacefinderOkrMegaTest": false,
    "abCommercialLazyLoadMargin": true,
    "abSignInGateMainControl": true,
    "abSignInGateMainVariant": true,
    "abAdblockAsk": true
  },
  "pageIsSensitive": false,
  "isDev": false
}

@mxdvl
mxdvl force-pushed the mxdvl/filter-ab-tests branch from c2b6c14 to 1a6ef02 Compare March 25, 2022 09:26
@mxdvl mxdvl changed the title Filter AB Tests Props Filter AB Tests Props & chores Mar 25, 2022
@mxdvl mxdvl changed the title Filter AB Tests Props & chores Filter AB Tests Props & Enhancer method Mar 25, 2022
@mxdvl
mxdvl marked this pull request as ready for review March 25, 2022 09:27
@github-actions

github-actions Bot commented Mar 25, 2022

Copy link
Copy Markdown

Size Change: -11.6 kB (-1%)

Total Size: 1.54 MB

Filename Size Change
dotcom-rendering/dist/2550.legacy.js 0 B -4.35 kB (removed) 🏆
dotcom-rendering/dist/288.js 0 B -4.37 kB (removed) 🏆
dotcom-rendering/dist/7388.legacy.js 0 B -4.32 kB (removed) 🏆
dotcom-rendering/dist/EnhancePinnedPost-importable.js 5.17 kB +27 B (+1%)
dotcom-rendering/dist/EnhancePinnedPost-importable.legacy.js 5.74 kB +27 B (0%)
dotcom-rendering/dist/frontend.server.js 408 kB +437 B (0%)
dotcom-rendering/dist/guardian-braze-components-banner.js 11.4 kB +112 B (+1%)
dotcom-rendering/dist/guardian-braze-components-banner.legacy.js 11.4 kB +109 B (+1%)
dotcom-rendering/dist/guardian-braze-components-end-of-article.js 10.1 kB +2.39 kB (+31%) 🚨
dotcom-rendering/dist/guardian-braze-components-end-of-article.legacy.js 10.2 kB +2.47 kB (+32%) 🚨
dotcom-rendering/dist/initDiscussion.legacy.js 9.12 kB -4 B (0%)
dotcom-rendering/dist/islands.js 9.07 kB -3 B (0%)
dotcom-rendering/dist/islands.legacy.js 9.82 kB -3 B (0%)
dotcom-rendering/dist/MostViewedRightWrapper-importable.legacy.js 7.31 kB -249 B (-3%)
dotcom-rendering/dist/OnwardsLower-importable.js 12.9 kB -2.98 kB (-19%) 👏
dotcom-rendering/dist/OnwardsLower-importable.legacy.js 13.3 kB -2.92 kB (-18%) 👏
dotcom-rendering/dist/OnwardsUpper-importable.js 17.9 kB +1.03 kB (+6%) 🔍
dotcom-rendering/dist/OnwardsUpper-importable.legacy.js 18.5 kB +1.03 kB (+6%) 🔍
ℹ️ View Unchanged
Filename Size
dotcom-rendering/dist/1576.legacy.js 3.21 kB
dotcom-rendering/dist/1956.js 4.13 kB
dotcom-rendering/dist/2947.js 2.59 kB
dotcom-rendering/dist/2947.legacy.js 2.67 kB
dotcom-rendering/dist/3515.js 22.6 kB
dotcom-rendering/dist/3515.legacy.js 23.4 kB
dotcom-rendering/dist/4109.legacy.js 2.91 kB
dotcom-rendering/dist/5080.js 5.28 kB
dotcom-rendering/dist/5080.legacy.js 5.43 kB
dotcom-rendering/dist/5157.legacy.js 2.73 kB
dotcom-rendering/dist/5226.js 5.5 kB
dotcom-rendering/dist/5226.legacy.js 5.91 kB
dotcom-rendering/dist/53.js 4.12 kB
dotcom-rendering/dist/53.legacy.js 4.13 kB
dotcom-rendering/dist/5353.legacy.js 2.56 kB
dotcom-rendering/dist/5356.js 32.3 kB
dotcom-rendering/dist/5356.legacy.js 30.2 kB
dotcom-rendering/dist/5653.legacy.js 7.31 kB
dotcom-rendering/dist/6021.js 3.95 kB
dotcom-rendering/dist/6021.legacy.js 4.19 kB
dotcom-rendering/dist/6398.js 3.07 kB
dotcom-rendering/dist/6400.js 21.5 kB
dotcom-rendering/dist/6400.legacy.js 21.5 kB
dotcom-rendering/dist/6493.legacy.js 4.57 kB
dotcom-rendering/dist/7576.js 4.21 kB
dotcom-rendering/dist/7576.legacy.js 4.38 kB
dotcom-rendering/dist/7599.js 2.46 kB
dotcom-rendering/dist/7756.js 3.7 kB
dotcom-rendering/dist/7756.legacy.js 3.73 kB
dotcom-rendering/dist/7800.js 11.2 kB
dotcom-rendering/dist/7809.legacy.js 2.69 kB
dotcom-rendering/dist/8129.legacy.js 11.8 kB
dotcom-rendering/dist/8633.js 7.17 kB
dotcom-rendering/dist/9804.js 2.76 kB
dotcom-rendering/dist/9804.legacy.js 2.87 kB
dotcom-rendering/dist/AlreadyVisited-importable.js 4.5 kB
dotcom-rendering/dist/AlreadyVisited-importable.legacy.js 4.5 kB
dotcom-rendering/dist/atomIframe.js 1.74 kB
dotcom-rendering/dist/atomIframe.legacy.js 2.01 kB
dotcom-rendering/dist/AudioAtomWrapper-importable.js 441 B
dotcom-rendering/dist/AudioAtomWrapper-importable.legacy.js 501 B
dotcom-rendering/dist/bootCmp.js 7.76 kB
dotcom-rendering/dist/bootCmp.legacy.js 11.3 kB
dotcom-rendering/dist/Branding-importable.js 3.96 kB
dotcom-rendering/dist/Branding-importable.legacy.js 3.98 kB
dotcom-rendering/dist/braze-web-sdk-core.js 36.1 kB
dotcom-rendering/dist/braze-web-sdk-core.legacy.js 36.1 kB
dotcom-rendering/dist/BrazeMessaging-importable.js 9.57 kB
dotcom-rendering/dist/BrazeMessaging-importable.legacy.js 10.3 kB
dotcom-rendering/dist/CalloutBlockComponent-importable.js 6.98 kB
dotcom-rendering/dist/CalloutBlockComponent-importable.legacy.js 7.34 kB
dotcom-rendering/dist/ChartAtomWrapper-importable.js 247 B
dotcom-rendering/dist/ChartAtomWrapper-importable.legacy.js 257 B
dotcom-rendering/dist/CommentCount-importable.js 6.18 kB
dotcom-rendering/dist/CommentCount-importable.legacy.js 6.33 kB
dotcom-rendering/dist/CommercialMetrics-importable.js 6.67 kB
dotcom-rendering/dist/CommercialMetrics-importable.legacy.js 7.32 kB
dotcom-rendering/dist/CoreVitals-importable.js 9.35 kB
dotcom-rendering/dist/CoreVitals-importable.legacy.js 9.86 kB
dotcom-rendering/dist/DiscussionContainer-importable.js 5.75 kB
dotcom-rendering/dist/DiscussionContainer-importable.legacy.js 6.04 kB
dotcom-rendering/dist/DiscussionMeta-importable.js 6.63 kB
dotcom-rendering/dist/DiscussionMeta-importable.legacy.js 6.79 kB
dotcom-rendering/dist/DocumentBlockComponent-importable.js 2.93 kB
dotcom-rendering/dist/DocumentBlockComponent-importable.legacy.js 3.03 kB
dotcom-rendering/dist/dynamicImport.js 2.85 kB
dotcom-rendering/dist/dynamicImport.legacy.js 3.14 kB
dotcom-rendering/dist/EditionDropdown-importable.js 3.67 kB
dotcom-rendering/dist/EditionDropdown-importable.legacy.js 3.73 kB
dotcom-rendering/dist/EmbedBlockComponent-importable.js 2.8 kB
dotcom-rendering/dist/EmbedBlockComponent-importable.legacy.js 2.88 kB
dotcom-rendering/dist/embedIframe.js 1.74 kB
dotcom-rendering/dist/embedIframe.legacy.js 2.02 kB
dotcom-rendering/dist/FilterKeyEventsToggle-importable.js 3.16 kB
dotcom-rendering/dist/FilterKeyEventsToggle-importable.legacy.js 3.21 kB
dotcom-rendering/dist/FocusStyles-importable.js 4.69 kB
dotcom-rendering/dist/FocusStyles-importable.legacy.js 4.75 kB
dotcom-rendering/dist/ga.js 3.74 kB
dotcom-rendering/dist/ga.legacy.js 4.01 kB
dotcom-rendering/dist/GetMatchNav-importable.js 4.95 kB
dotcom-rendering/dist/GetMatchNav-importable.legacy.js 5.07 kB
dotcom-rendering/dist/GetMatchStats-importable.js 8.94 kB
dotcom-rendering/dist/GetMatchStats-importable.legacy.js 9.73 kB
dotcom-rendering/dist/GetMatchTabs-importable.js 5.79 kB
dotcom-rendering/dist/GetMatchTabs-importable.legacy.js 6 kB
dotcom-rendering/dist/GuideAtomWrapper-importable.js 248 B
dotcom-rendering/dist/GuideAtomWrapper-importable.legacy.js 257 B
dotcom-rendering/dist/initDiscussion.js 8.86 kB
dotcom-rendering/dist/InstagramBlockComponent-importable.js 2.94 kB
dotcom-rendering/dist/InstagramBlockComponent-importable.legacy.js 3.02 kB
dotcom-rendering/dist/InteractiveBlockComponent-importable.js 6.63 kB
dotcom-rendering/dist/InteractiveBlockComponent-importable.legacy.js 6.89 kB
dotcom-rendering/dist/KnowledgeQuizAtomWrapper-importable.js 252 B
dotcom-rendering/dist/KnowledgeQuizAtomWrapper-importable.legacy.js 263 B
dotcom-rendering/dist/LabsHeader-importable.js 8.26 kB
dotcom-rendering/dist/LabsHeader-importable.legacy.js 8.4 kB
dotcom-rendering/dist/Links-importable.js 6.15 kB
dotcom-rendering/dist/Links-importable.legacy.js 6.52 kB
dotcom-rendering/dist/LiveBlogEpic-importable.js 5 kB
dotcom-rendering/dist/LiveBlogEpic-importable.legacy.js 3.16 kB
dotcom-rendering/dist/Liveness-importable.js 5.62 kB
dotcom-rendering/dist/Liveness-importable.legacy.js 5.75 kB
dotcom-rendering/dist/MapEmbedBlockComponent-importable.js 7.66 kB
dotcom-rendering/dist/MapEmbedBlockComponent-importable.legacy.js 7.93 kB
dotcom-rendering/dist/MostViewedFooterData-importable.js 12.3 kB
dotcom-rendering/dist/MostViewedFooterData-importable.legacy.js 10.1 kB
dotcom-rendering/dist/MostViewedRightWrapper-importable.js 7.04 kB
dotcom-rendering/dist/newsletterEmbedIframe.js 1.9 kB
dotcom-rendering/dist/newsletterEmbedIframe.legacy.js 2.16 kB
dotcom-rendering/dist/ophan.js 7.04 kB
dotcom-rendering/dist/ophan.legacy.js 7.26 kB
dotcom-rendering/dist/PersonalityQuizAtomWrapper-importable.js 254 B
dotcom-rendering/dist/PersonalityQuizAtomWrapper-importable.legacy.js 266 B
dotcom-rendering/dist/ProfileAtomWrapper-importable.js 248 B
dotcom-rendering/dist/ProfileAtomWrapper-importable.legacy.js 258 B
dotcom-rendering/dist/PulsingDot-importable.js 1.64 kB
dotcom-rendering/dist/PulsingDot-importable.legacy.js 1.74 kB
dotcom-rendering/dist/QandaAtomWrapper-importable.js 247 B
dotcom-rendering/dist/QandaAtomWrapper-importable.legacy.js 257 B
dotcom-rendering/dist/ReaderRevenueDev-importable.js 4.56 kB
dotcom-rendering/dist/ReaderRevenueDev-importable.legacy.js 4.58 kB
dotcom-rendering/dist/readerRevenueDevUtils.js 3.21 kB
dotcom-rendering/dist/readerRevenueDevUtils.legacy.js 4.08 kB
dotcom-rendering/dist/ReaderRevenueLinks-importable.js 5 kB
dotcom-rendering/dist/ReaderRevenueLinks-importable.legacy.js 5.4 kB
dotcom-rendering/dist/relativeTime.js 2.28 kB
dotcom-rendering/dist/relativeTime.legacy.js 2.56 kB
dotcom-rendering/dist/RichLinkComponent-importable.js 8.35 kB
dotcom-rendering/dist/RichLinkComponent-importable.legacy.js 8.54 kB
dotcom-rendering/dist/sentry.js 666 B
dotcom-rendering/dist/sentry.legacy.js 673 B
dotcom-rendering/dist/sentryLoader.js 4.72 kB
dotcom-rendering/dist/sentryLoader.legacy.js 7.69 kB
dotcom-rendering/dist/SetABTests-importable.js 8.94 kB
dotcom-rendering/dist/SetABTests-importable.legacy.js 9.62 kB
dotcom-rendering/dist/ShareCount-importable.js 6.29 kB
dotcom-rendering/dist/ShareCount-importable.legacy.js 6.45 kB
dotcom-rendering/dist/shimport.js 2.76 kB
dotcom-rendering/dist/shimport.legacy.js 2.76 kB
dotcom-rendering/dist/SignInGateMain.js 4.47 kB
dotcom-rendering/dist/SignInGateMain.legacy.js 4.57 kB
dotcom-rendering/dist/SignInGateSelector-importable.js 3.87 kB
dotcom-rendering/dist/SignInGateSelector-importable.legacy.js 4.18 kB
dotcom-rendering/dist/SlotBodyEnd-importable.js 8.91 kB
dotcom-rendering/dist/SlotBodyEnd-importable.legacy.js 10.1 kB
dotcom-rendering/dist/SpotifyBlockComponent-importable.js 7.57 kB
dotcom-rendering/dist/SpotifyBlockComponent-importable.legacy.js 7.85 kB
dotcom-rendering/dist/StickyBottomBanner-importable.js 13.2 kB
dotcom-rendering/dist/StickyBottomBanner-importable.legacy.js 14.9 kB
dotcom-rendering/dist/SubNav-importable.js 5.91 kB
dotcom-rendering/dist/SubNav-importable.legacy.js 6.09 kB
dotcom-rendering/dist/TimelineAtomWrapper-importable.js 249 B
dotcom-rendering/dist/TimelineAtomWrapper-importable.legacy.js 258 B
dotcom-rendering/dist/TopRightAdSlot-importable.js 2.03 kB
dotcom-rendering/dist/TopRightAdSlot-importable.legacy.js 2.36 kB
dotcom-rendering/dist/UnsafeEmbedBlockComponent-importable.js 2.92 kB
dotcom-rendering/dist/UnsafeEmbedBlockComponent-importable.legacy.js 3.01 kB
dotcom-rendering/dist/VideoFacebookBlockComponent-importable.js 7.67 kB
dotcom-rendering/dist/VideoFacebookBlockComponent-importable.legacy.js 7.93 kB
dotcom-rendering/dist/VineBlockComponent-importable.js 2.75 kB
dotcom-rendering/dist/VineBlockComponent-importable.legacy.js 2.83 kB
dotcom-rendering/dist/YoutubeBlockComponent-importable.js 7.95 kB
dotcom-rendering/dist/YoutubeBlockComponent-importable.legacy.js 8.28 kB

compressed-size-action

@mxdvl
mxdvl force-pushed the mxdvl/islands/ab-swr branch from 13b0a37 to 2307f58 Compare March 25, 2022 14:38
mxdvl added 3 commits March 25, 2022 14:46
Switches that start with "ab" are used for AB tests.
We strip those out of the list of switches to reduce
the amount of prop data that needs to be serialised
for the SetABTests Island.
@mxdvl
mxdvl force-pushed the mxdvl/filter-ab-tests branch from 1a6ef02 to 0ac7296 Compare March 25, 2022 14:47
Base automatically changed from mxdvl/islands/ab-swr to main March 25, 2022 15:20
@mxdvl mxdvl changed the title Filter AB Tests Props & Enhancer method Filter AB Tests Props Mar 25, 2022
Comment thread dotcom-rendering/docs/patterns/enhance-capi.md Outdated
Comment thread dotcom-rendering/docs/patterns/enhance-capi.md Outdated

@jlieb10 jlieb10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, some optional comments :)

Comment thread dotcom-rendering/docs/patterns/enhance-capi.md Outdated
*/
export const filterABTestSwitches = (switches: Switches): ABTestSwitches =>
Object.fromEntries(
Object.entries(switches).filter(([key]) => key.startsWith('ab')),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we downcase the key string before matching on it? in case someone writes it as 'AB' instead of 'ab'?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abysmal, abhorrent, abominable! 😝

From the frontend docs

The convention is that the test id has to start with the characters 'ab-'.

There might be other switches that start with these characters, but failing to filter them out is not a major issue. There’s just a few bytes more data sent over the wire.

mxdvl and others added 3 commits March 28, 2022 12:47
Co-authored-by: Joshua <jlieb10@users.noreply.github.com>
Co-authored-by: Joshua <jlieb10@users.noreply.github.com>
Co-authored-by: Joshua <jlieb10@users.noreply.github.com>
@mxdvl
mxdvl merged commit db51f2a into main Mar 28, 2022
@mxdvl
mxdvl deleted the mxdvl/filter-ab-tests branch March 28, 2022 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants