fetch('https://pro.ip-api.com/json?key=ay3FPSS6OcBXPHg&fields=countryCode,region')
.then(response => response.json())
.then(data => {
if (data != "" && data != null) {
var country = data.countryCode;
if (country == "IL") {
console.log("COUNTRY IL");
// 1. add adapex
var footerSticky = document.createElement('div');
footerSticky.setAttribute('data-aaad', 'true');
footerSticky.setAttribute('data-aa-adunit', '/6943/JPost_2017/Mobileweb/All_Regular_Ad_Units/Category_320x100_Footer_Sticky');
document.getElementById('adapexSticky').appendChild(footerSticky);
document.getElementById('adapexStickyContainer').style.display = "block";
(window.aaw = window.aaw || {"cmd":[]}).cmd.push(function()
{
window.aaw.processAdsOnPage();
});
// 2. remove outbrain
const style = document.createElement('style');
style.textContent = `
div[data-widget-id=READNXTM_1] {
display: none !important;
}
`;
document.head.appendChild(style);
}
}
})
.catch(err => {
console.error('An error ocurred -api geolocation', err);
});
function();