Skip to content

Commit ec4915b

Browse files
Merge pull request #14467 from guardian/jr/soft-optin-tracking
Adds tracking of the checkbox state for the similar_products checkbox to the ManyNewsletterSignUp event
2 parents d5aa144 + a792774 commit ec4915b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ export const ManyNewsletterSignUp = ({
261261
return undefined;
262262
});
263263

264+
const marketingOptInType = marketingOptIn
265+
? 'similar-guardian-products-optin'
266+
: 'similar-guardian-products-optout';
267+
264268
if (!response?.ok) {
265269
const responseText = response
266270
? await response.text()
@@ -271,6 +275,7 @@ export const ManyNewsletterSignUp = ({
271275
renderingTarget,
272276
{
273277
listIds,
278+
...(marketingOptIn !== undefined && { marketingOptInType }),
274279
// If the backend handles the failure and responds with an informative
275280
// error message (E.G. "Service unavailable", "Invalid email" etc) this
276281
// should be included in the event data.
@@ -289,6 +294,7 @@ export const ManyNewsletterSignUp = ({
289294
renderingTarget,
290295
{
291296
listIds,
297+
...(marketingOptIn !== undefined && { marketingOptInType }),
292298
},
293299
);
294300
setStatus('Success');

0 commit comments

Comments
 (0)