Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable landing page #6655

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open

Configurable landing page #6655

wants to merge 33 commits into from

Conversation

tomrf1
Copy link
Member

@tomrf1 tomrf1 commented Dec 23, 2024

Begins the process of making the landing page properly configurable.
For now it's just the heading and subheading.

Until now everything was hardcoded into the client, including any AB testing. Currently there's some logic for setting a different subheading for the US.

Instead we will now pass landing page config through to the client from the server in the guardian.settings object. This model supports AB testing. Targeting is by country group only for now.

In the longer term we'll define this config in a database and create a tool for configuring it. For now it's hardcoded into the backend in settings/LandingPageTest.scala.

Assignment to a test/variant happens in the existing AB test init function, but it uses the config from the server instead of the tests defined in abtestDefinitions.ts. In order to track participation through to the checkout we set a new session storage item, landingPageParticipations.

Copy link
Contributor

github-actions bot commented Dec 23, 2024

Size Change: +15.2 kB (+0.8%)

Total Size: 1.91 MB

Filename Size Change
./public/compiled-assets/javascripts/[countryGroupId]/router.js 95 kB +1.56 kB (+1.67%)
./public/compiled-assets/javascripts/paperSubscriptionCheckoutPage.js 164 kB +567 B (+0.35%)
./public/compiled-assets/javascripts/weeklySubscriptionCheckoutPage.js 161 kB +786 B (+0.49%)
./public/compiled-assets/webpack/187.js 20.7 kB +597 B (+2.98%)
./public/compiled-assets/webpack/719.js 0 B -13.5 kB (removed) 🏆
./public/compiled-assets/webpack/643.js 22.4 kB +22.4 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./public/compiled-assets/javascripts/[countryGroupId]/events/router.js 90.7 kB +329 B (+0.36%)
./public/compiled-assets/javascripts/ausMomentMap.js 108 kB 0 B
./public/compiled-assets/javascripts/contributionsRedirectStyles.js 20 B 0 B
./public/compiled-assets/javascripts/digitalSubscriptionLandingPage.js 223 kB +423 B (+0.19%)
./public/compiled-assets/javascripts/downForMaintenancePage.js 67.5 kB +218 B (+0.32%)
./public/compiled-assets/javascripts/error404Page.js 67.5 kB +217 B (+0.32%)
./public/compiled-assets/javascripts/error500Page.js 67.4 kB +214 B (+0.32%)
./public/compiled-assets/javascripts/favicons.js 617 B 0 B
./public/compiled-assets/javascripts/paperSubscriptionLandingPage.js 88 kB +293 B (+0.33%)
./public/compiled-assets/javascripts/payPalErrorPage.js 66 kB +76 B (+0.12%)
./public/compiled-assets/javascripts/payPalErrorPageStyles.js 20 B 0 B
./public/compiled-assets/javascripts/promotionTerms.js 74.1 kB +416 B (+0.56%)
./public/compiled-assets/javascripts/subscriptionsLandingPage.js 78.5 kB +453 B (+0.58%)
./public/compiled-assets/javascripts/subscriptionsRedemptionPage.js 119 kB +317 B (+0.27%)
./public/compiled-assets/javascripts/unsupportedBrowserStyles.js 20 B 0 B
./public/compiled-assets/javascripts/weeklySubscriptionLandingPage.js 88.2 kB -74 B (-0.08%)
./public/compiled-assets/webpack/114.js 12.2 kB 0 B
./public/compiled-assets/webpack/127.js 3.53 kB 0 B
./public/compiled-assets/webpack/136.js 2.17 kB 0 B
./public/compiled-assets/webpack/163.js 8.9 kB 0 B
./public/compiled-assets/webpack/192.js 5.69 kB 0 B
./public/compiled-assets/webpack/276.js 4.39 kB 0 B
./public/compiled-assets/webpack/344.js 2 kB 0 B
./public/compiled-assets/webpack/445.js 6.94 kB 0 B
./public/compiled-assets/webpack/492.js 7.58 kB 0 B
./public/compiled-assets/webpack/706.js 107 kB 0 B
./public/compiled-assets/webpack/847.js 26 kB 0 B
./public/compiled-assets/webpack/953.js 37.4 kB 0 B
./public/compiled-assets/webpack/checkout.js 17.1 kB +2 B (+0.01%)
./public/compiled-assets/webpack/GuardianAdLiteLanding.js 8.26 kB 0 B
./public/compiled-assets/webpack/LandingPage.js 15.4 kB -163 B (-1.05%)
./public/compiled-assets/webpack/oneTimeCheckout.js 6.07 kB 0 B
./public/compiled-assets/webpack/ThankYou.js 44.5 kB +1 B (0%)

compressed-size-action

@tomrf1 tomrf1 changed the title WIP - landing page config Configurable landing page Feb 3, 2025
@@ -219,22 +235,6 @@ function getParticipationsFromUrl(): Participations | undefined {
return;
}

function getParticipationsFromSession(): Participations | undefined {
Copy link
Member Author

Choose a reason for hiding this comment

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

moved to sessionStorage.ts for reuse

@@ -138,12 +137,6 @@ const paymentFrequencyButtonsCss = css`
}
`;

const tabletLineBreak = css`
${from.desktop} {
display: none;
Copy link
Member Author

Choose a reason for hiding this comment

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

The need for this css is replaced by the text-wrap: balance on the heading. It means the line break still happens after the comma when it wraps:
Screenshot 2025-02-04 at 10 04 22
And it saves us from needing separate config for mobile vs desktop

@tomrf1 tomrf1 marked this pull request as ready for review February 7, 2025 13:41
} from '../landingPageAbTests';
import { LANDING_PAGE_PARTICIPATIONS_KEY } from '../sessionStorage';

const ukTest: LandingPageTest = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be renamed to non-US Test as we're passing in all the country groups other than the US here? Or we could just pass in the GBPCountries

export type LandingPageSelection = LandingPageVariant & { testName: string };

export const fallBackLandingPageSelection: LandingPageSelection = {
testName: 'FALLBACK_LANDING_PAGE',
Copy link
Contributor

Choose a reason for hiding this comment

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

Will the fallback be hardcoded or will we pull config from DynamoDB? I don't mind it being hard coded as it's problaby quite important that it doesn't change

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I was thinking we should keep it hardcoded in the client, in case something goes wrong elsewhere

Copy link
Contributor

Choose a reason for hiding this comment

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

Great idea! We could add a code comment explaining that or some sort of warning to not change the template

const participations = storage.getSession(key);
if (participations) {
try {
return JSON.parse(participations) as Participations;
Copy link
Contributor

@paul-daniel-dempsey paul-daniel-dempsey Feb 10, 2025

Choose a reason for hiding this comment

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

fyi: Not necessary but we recently setup a module for session storage, it uses Valibot.Is to check objects from session storage match a schema, might be of interest shown here.

return;
} else {
// This is not a landing page, but check if the session has a landing page test participation
return getSessionParticipations(LANDING_PAGE_PARTICIPATIONS_KEY);
Copy link
Contributor

Choose a reason for hiding this comment

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

fyi: We have been reporting to Data Privacy re: new session storage items. Just in case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks - I've submitted the DP form for this

};
const participations: Participations = abTest.init(abtestInitalizerData);
console.log({ participations });
Copy link
Contributor

Choose a reason for hiding this comment

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

just checking needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, but I've found it really useful for checking what test participations are on each page, particularly when we want it to carry throught to the checkout. I used to use a redux browser extension for this but that's no longer an option!

Copy link
Contributor

@paul-daniel-dempsey paul-daniel-dempsey left a comment

Choose a reason for hiding this comment

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

Looks really great, very neat. ab-tests, smoke and cron tests pass.

Copy link
Contributor

@charleycampbell charleycampbell left a comment

Choose a reason for hiding this comment

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

This looks great Tom! First steps a an exciting feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants