Support Forums - Classified Ads Script Osclass
Osclass plugin support => Advertisement Manager Plugin => Topic started by: Zbyszek Ochelski on June 13, 2018, 08:49:29 AM
-
Hi, is possible to show banners in specifiek countries using js code like:
// List of countries we want to show banner
var whitelist = ['US', 'CA', 'UK', 'IN']
// Getting the country code from the user's IP
$.get("https://api.ipdata.co", function (response) {
// Checking if the user's country code is in the whitelist
if (blacklist.includes(response.country_code)) {
('show banner');
} else {
("Don't show this banner, but show other")
}
}, "jsonp");
Please show me how i can do that correctly?
-
Hello
Theoretically yes, if you complete that code.
-
the problem is i can't complete this code because i find it on internet and im not programmer... i dont know how... and i dont know also what code i have to use from Your plugin to written in this code, is dificoult to finish this code? i think solution like this will help many people with problem divide banners on countrys or regions.
-
You can put region/country name to keyword to prioritize banner on search page in certain geo.
Code is just "hand-made" and would need updates when there is new banner...
-
i can put this code for each banner i think. Ok keywords, but what when user dont browsing by region or country. I dont want to show users banners from deutchald when somebody browsing portal from spain...
-
That could be secured from php side, but such geolocation use to be not accurate.