Skip to content

Commit e6371b2

Browse files
- fixing utmParamsString to actually pass through the utmParamsFromReferrer if utmParamsFromArticleURL is not there
1 parent 3197cd6 commit e6371b2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { useBetaAB } from '../lib/useAB';
2323
* (No visual story exists as this does not render anything)
2424
*/
2525

26+
// Helper to extract UTM parameters from URLSearchParams
2627
function getUtmString(params: URLSearchParams, keys: string[]): string {
2728
return keys
2829
.map((key) => {
@@ -72,8 +73,11 @@ export const EnhanceAffiliateLinks = () => {
7273
console.log('utmFromReferrer:', utmParamsFromReferrer);
7374

7475
const utmParamsString =
75-
utmParamsFromArticleURL ?? utmParamsFromReferrer ?? '';
76-
console.log('final utmParamsString:', utmParamsString);
76+
utmParamsFromArticleURL && utmParamsFromArticleURL.trim() !== ''
77+
? utmParamsFromArticleURL
78+
: utmParamsFromReferrer && utmParamsFromReferrer.trim() !== ''
79+
? utmParamsFromReferrer
80+
: '';
7781

7882
for (const link of allLinksOnPage) {
7983
if (isSkimlink(link.href)) {

0 commit comments

Comments
 (0)