<script src="//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js" type="text/javascript"></script>
<script type="text/javascript">
var queryCountry = (function () {
var onSuccess = function (geoipResponse) {
var popupstatus = $.cookie('popupstatus')
var country = geoipResponse.country.iso_code
if(popupstatus != 'popped' && country != 'AU'){
// open fancybox
$.fancybox.open([
{
href : '/internationalpopup' // This is the URL to the page which contains the contents for the popup
}
], {
padding : 20
});
// Set the cookie popupstatus to be popped so it does not bug the customer again
$.cookie('popupstatus', 'popped');
}
};
var onError = function (error) {
var country = none
};
return function () {
geoip2.country(onSuccess, onError);
};
}());
queryCountry();
</script>
Maxmind GeoIP
Please note that the service will use MaxMind GeoIP2 and you will need to follow the below step to set up your GeoIP service.
- You will need to purchase the credit from the following url https://www.maxmind.com/en/javascript
- Once you login to your MaxMind Account, you will need to go to "JavaScript Service Domains" (Under Account Information Menu)
- Then, add your Neto Website Domain. (e.g. www.yourhost.com.au)
They have a trial so you can make a trial for the client and send them the details to take it over. Takes a few hours for them to set up your trial so do this first.
cookie.js
Just load this in the footer directly below where jquery is being loaded:
<script type="text/javascript" src="//cdn.neto.com.au/assets/neto-cdn/jquery_cookie/jquery.cookie.js"></script>