Use JS URL api to manipulate URL in referral id decorator
[MAILPOET-2182]
This commit is contained in:
committed by
M. Shull
parent
5d665f982e
commit
72f5a6e02e
@ -2,15 +2,9 @@ const addReferralId = (url) => {
|
|||||||
if (!window.mailpoet_referral_id) {
|
if (!window.mailpoet_referral_id) {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
const parser = document.createElement('a');
|
const refUrl = new URL(url);
|
||||||
parser.href = url;
|
refUrl.searchParams.set('ref', window.mailpoet_referral_id);
|
||||||
parser.search += parser.search ? '&' : '?';
|
return refUrl.toString();
|
||||||
parser.search += `ref=${encodeURIComponent(window.mailpoet_referral_id)}`;
|
|
||||||
return parser.toString();
|
|
||||||
|
|
||||||
// const refUrl = new URL(url);
|
|
||||||
// refUrl.searchParams.set('ref', window.mailpoet_referral_id);
|
|
||||||
// return refUrl.toString();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default addReferralId;
|
export default addReferralId;
|
||||||
|
Reference in New Issue
Block a user