console.log('The country 1 ');
fetch('https://pro.ip-api.com/json?key=ay3FPSS6OcBXPHg&fields=countryCode,region')
.then(response => response.json())
.then(data => {
console.log('The country 2 ');
if (data != "" && data != null) {
var country = data.countryCode;
console.log("COUNTRY 3: " + country);
if (country == "IL") {
// 1. add adapex
console.log("COUNTRY ILLLL");
var footerSticky = document.createElement('div');
footerSticky.setAttribute('jpost-id', 'adapex_sticky');
footerSticky.setAttribute('data-aaad', 'true');
footerSticky.setAttribute('data-aa-adunit', '/6943/JPost_2017/Mobileweb/All_Regular_Ad_Units/320x100_Footer_Sticky');
document.getElementById('adapexSticky').appendChild(footerSticky);
document.getElementById('adapexStickyContainer').style.display = "block";
// 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();