Add new HTML block after Prices list block with this content
<script type="module">
let paywallLinks = [
'https://LINK_1/?web2wave_user_id={user_id}',
'https://LINK_2/?web2wave_user_id={user_id}',
'https://LINK_3/?web2wave_user_id={user_id}'
];
function setPaywallPrice(priceId) {
const priceElements = document.querySelectorAll('[data-price-id]');
let link = null;
debugger;
priceElements.forEach((el, index) => {
if (!link && priceId == el.getAttribute('data-price-id')) {
link = paywallLinks[index];
}
});
if (link) {
document.querySelectorAll('[data-payment-link], [data-popup="#popup-plan"]').forEach(el => {
el.setAttribute('href', link);
});
}
}
AnalyticsManager.on('Paywall click price', function(eventProperties) {
setPaywallPrice(eventProperties.price_id);
});
setTimeout(() => {
const priceElements = document.querySelectorAll('[data-price-id]');
if (!priceElements.length) return;
const defaultPriceId = priceElements[0].getAttribute('data-price-id');
setPaywallPrice(defaultPriceId);
const oldElement = document.querySelector('[data-popup="#popup-plan"]');
if (!oldElement) return;
const newElement = document.createElement('a');
newElement.innerHTML = oldElement.innerHTML;
for (let attr of oldElement.attributes) {
newElement.setAttribute(attr.name, attr.value);
}
newElement.removeAttribute('data-popup');
newElement.setAttribute('data-payment-link', '');
oldElement.parentNode.replaceChild(newElement, oldElement);
}, 200);
</script>