Skip to content

Commit addcc16

Browse files
authored
Merge pull request #13379 from guardian/ph-20250213-1431-async-logTreatmentInteractionCall
auxia experiment: await for async log treatment API calls
2 parents 830db1e + c2c6324 commit addcc16

File tree

1 file changed

+20
-57
lines changed

1 file changed

+20
-57
lines changed

dotcom-rendering/src/components/SignInGate/gateDesigns/SignInGateAuxia.tsx

Lines changed: 20 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,18 @@ export const SignInGateAuxia = ({
6767
<button
6868
data-testid="sign-in-gate-main_privacy"
6969
css={privacyLink}
70-
onClick={() => {
70+
onClick={async () => {
7171
cmp.showPrivacyManager();
7272
trackLink(
7373
ophanComponentId,
7474
'privacy',
7575
renderingTarget,
7676
abTest,
7777
);
78-
logTreatmentInteractionCall(
78+
await logTreatmentInteractionCall(
7979
'CLICKED',
8080
'PRIVACY-BUTTON',
81-
).catch((error) => {
82-
console.error(
83-
'Failed to log treatment interaction:',
84-
error,
85-
);
86-
});
81+
);
8782
}}
8883
>
8984
privacy settings
@@ -99,22 +94,17 @@ export const SignInGateAuxia = ({
9994
priority="primary"
10095
size="small"
10196
href={firstCtaLink}
102-
onClick={() => {
97+
onClick={async () => {
10398
trackLink(
10499
ophanComponentId,
105100
'register-link',
106101
renderingTarget,
107102
abTest,
108103
);
109-
logTreatmentInteractionCall(
104+
await logTreatmentInteractionCall(
110105
'CLICKED',
111106
'REGISTER-LINK',
112-
).catch((error) => {
113-
console.error(
114-
'Failed to log treatment interaction:',
115-
error,
116-
);
117-
});
107+
);
118108
}}
119109
>
120110
{firstCtaName}
@@ -125,22 +115,15 @@ export const SignInGateAuxia = ({
125115
cssOverrides={laterButton}
126116
priority="subdued"
127117
size="small"
128-
onClick={() => {
118+
onClick={async () => {
129119
dismissGate();
130120
trackLink(
131121
ophanComponentId,
132122
'not-now',
133123
renderingTarget,
134124
abTest,
135125
);
136-
logTreatmentInteractionCall('DISMISSED', '').catch(
137-
(error) => {
138-
console.error(
139-
'Failed to log treatment interaction:',
140-
error,
141-
);
142-
},
143-
);
126+
await logTreatmentInteractionCall('DISMISSED', '');
144127
}}
145128
>
146129
{secondCtaName}
@@ -156,22 +139,17 @@ export const SignInGateAuxia = ({
156139
data-ignore="global-link-styling"
157140
cssOverrides={signInLink}
158141
href={signInUrl}
159-
onClick={() => {
142+
onClick={async () => {
160143
trackLink(
161144
ophanComponentId,
162145
'sign-in-link',
163146
renderingTarget,
164147
abTest,
165148
);
166-
logTreatmentInteractionCall(
149+
await logTreatmentInteractionCall(
167150
'CLICKED',
168151
'SIGN-IN-LINK',
169-
).catch((error) => {
170-
console.error(
171-
'Failed to log treatment interaction:',
172-
error,
173-
);
174-
});
152+
);
175153
}}
176154
>
177155
Sign In
@@ -181,22 +159,17 @@ export const SignInGateAuxia = ({
181159
<Link
182160
data-ignore="global-link-styling"
183161
href={`${guUrl}/membership/2019/dec/20/signing-in-to-the-guardian`}
184-
onClick={() => {
162+
onClick={async () => {
185163
trackLink(
186164
ophanComponentId,
187165
'how-link',
188166
renderingTarget,
189167
abTest,
190168
);
191-
logTreatmentInteractionCall(
169+
await logTreatmentInteractionCall(
192170
'CLICKED',
193171
'HOW-TO-LINK',
194-
).catch((error) => {
195-
console.error(
196-
'Failed to log treatment interaction:',
197-
error,
198-
);
199-
});
172+
);
200173
}}
201174
>
202175
Why register & how does it help?
@@ -205,22 +178,17 @@ export const SignInGateAuxia = ({
205178
<Link
206179
data-ignore="global-link-styling"
207180
href={`${guUrl}/info/2014/nov/03/why-your-data-matters-to-us-full-text`}
208-
onClick={() => {
181+
onClick={async () => {
209182
trackLink(
210183
ophanComponentId,
211184
'why-link',
212185
renderingTarget,
213186
abTest,
214187
);
215-
logTreatmentInteractionCall(
188+
await logTreatmentInteractionCall(
216189
'CLICKED',
217190
'WHY-LINK',
218-
).catch((error) => {
219-
console.error(
220-
'Failed to log treatment interaction:',
221-
error,
222-
);
223-
});
191+
);
224192
}}
225193
>
226194
How will my information & data be used?
@@ -229,22 +197,17 @@ export const SignInGateAuxia = ({
229197
<Link
230198
data-ignore="global-link-styling"
231199
href={`${guUrl}/help/identity-faq`}
232-
onClick={() => {
200+
onClick={async () => {
233201
trackLink(
234202
ophanComponentId,
235203
'help-link',
236204
renderingTarget,
237205
abTest,
238206
);
239-
logTreatmentInteractionCall(
207+
await logTreatmentInteractionCall(
240208
'CLICKED',
241209
'HELP-LINK',
242-
).catch((error) => {
243-
console.error(
244-
'Failed to log treatment interaction:',
245-
error,
246-
);
247-
});
210+
);
248211
}}
249212
>
250213
Get help with registering or signing in

0 commit comments

Comments
 (0)