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) {
|
||||
return url;
|
||||
}
|
||||
const parser = document.createElement('a');
|
||||
parser.href = url;
|
||||
parser.search += parser.search ? '&' : '?';
|
||||
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();
|
||||
const refUrl = new URL(url);
|
||||
refUrl.searchParams.set('ref', window.mailpoet_referral_id);
|
||||
return refUrl.toString();
|
||||
};
|
||||
|
||||
export default addReferralId;
|
||||
|
Reference in New Issue
Block a user