I'm trying to create a pop-up that is going to be triggered to any user that is coming from outside the US. I've created a pop-up with the custom trigger and also the code to be added on the theme.liquid just before the </body> . However I can't make it work, any ideas?
<script type="text/javascript">
function getGeolocation(callback) {
const userCountryCode = 'US';
callback(userCountryCode);
}
function openPopUpBasedOnGeolocation(userCountryCode) {
if (userCountryCode !== 'US') {
window._klOnsite = window._klOnsite || d];
window._klOnsite.push(n'openForm', 'FORM_ID']);
}
}
openPopUpBasedOnGeolocation
getGeolocation(function (userCountryCode) {
openPopUpBasedOnGeolocation(userCountryCode);
});
</script>