Stripping /trial from affiliate URL.
This commit is contained in:
parent
166f4ee7ce
commit
63bee8f5e0
|
|
@ -46,13 +46,13 @@ function getAffiliateUrl(scene) {
|
||||||
return watchUrl;
|
return watchUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scene.affiliate.url?.includes('/track')) { // nats redirect
|
if (scene.affiliate.url?.includes('/track')) { // standard NATS redirect
|
||||||
const { pathname, search } = new URL(watchUrl);
|
const { pathname, search } = new URL(watchUrl);
|
||||||
|
|
||||||
return `${scene.affiliate.url}${pathname}${search}`;
|
return `${scene.affiliate.url}${pathname.replace(/^\/trial/, '')}${search}`; // replace needed for Jules Jordan, verify behavior on other sites
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scene.affiliate.parameters) { // TODO: this is probably not getting tracked...
|
if (scene.affiliate.parameters) { // used by e.g. Bang
|
||||||
const newParams = new URLSearchParams({
|
const newParams = new URLSearchParams({
|
||||||
...Object.fromEntries(new URL(watchUrl).searchParams),
|
...Object.fromEntries(new URL(watchUrl).searchParams),
|
||||||
...Object.fromEntries(new URLSearchParams(scene.affiliate.parameters)),
|
...Object.fromEntries(new URLSearchParams(scene.affiliate.parameters)),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue