Skip to content

Commit 194b397

Browse files
committed
feat(google-one-tap): Render Google One Tap on Tag Pages and Articles
1 parent 5e405f0 commit 194b397

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

dotcom-rendering/src/components/ArticlePage.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { useConfig } from './ConfigContext';
1414
import { DarkModeMessage } from './DarkModeMessage';
1515
import { EnhanceAffiliateLinks } from './EnhanceAffiliateLinks.importable';
1616
import { FocusStyles } from './FocusStyles.importable';
17+
import { GoogleOneTap, isInGoogleOneTapTest } from './GoogleOneTap.importable';
1718
import { Island } from './Island';
1819
import { Lightbox } from './Lightbox';
1920
import { Metrics } from './Metrics.importable';
@@ -139,6 +140,14 @@ export const ArticlePage = (props: WebProps | AppProps) => {
139140
}
140141
/>
141142
</Island>
143+
{isInGoogleOneTapTest(frontendData.config.abTests) && (
144+
<Island
145+
priority="enhancement"
146+
defer={{ until: 'idle' }}
147+
>
148+
<GoogleOneTap />
149+
</Island>
150+
)}
142151
</>
143152
)}
144153
{renderingTarget === 'Web' ? (

dotcom-rendering/src/components/GoogleOneTap.importable.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,8 @@ export const initializeFedCM = async ({
255255
}
256256
};
257257

258-
// TODO: GoogleOneTap is currently only used on the front page, but we do probably want to use it on other pages in the future.
259258
export const GoogleOneTap = () => {
260259
// We don't care what consent we get, we just want to make sure Google One Tap is not shown above the consent banner.
261-
// TODO: FedCM doesn't require cookies? Do we need to check consent?
262260
const consent = useConsent();
263261
const isSignedIn = useIsSignedIn();
264262
const countryCode = useCountryCode('google-one-tap');

dotcom-rendering/src/components/TagPage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { AlreadyVisited } from './AlreadyVisited.importable';
1111
import { useConfig } from './ConfigContext';
1212
import { DarkModeMessage } from './DarkModeMessage';
1313
import { FocusStyles } from './FocusStyles.importable';
14+
import { GoogleOneTap, isInGoogleOneTapTest } from './GoogleOneTap.importable';
1415
import { Island } from './Island';
1516
import { Metrics } from './Metrics.importable';
1617
import { SetABTests } from './SetABTests.importable';
@@ -82,6 +83,11 @@ export const TagPage = ({ tagPage, NAV }: Props) => {
8283
<Island priority="critical">
8384
<SetAdTargeting adTargeting={adTargeting} />
8485
</Island>
86+
{isInGoogleOneTapTest(tagPage.config.abTests) && (
87+
<Island priority="enhancement" defer={{ until: 'idle' }}>
88+
<GoogleOneTap />
89+
</Island>
90+
)}
8591
{darkModeAvailable && (
8692
<DarkModeMessage>
8793
Dark mode is a work-in-progress.

0 commit comments

Comments
 (0)