Show banners by country by js code (9 field)
« on: June 13, 2018, 08:49:29 AM »
Hi, is possible to show banners in specifiek countries using js code like:

Code: [Select]
// 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?
« Last Edit: June 13, 2018, 08:55:28 AM by Zbyszek Ochelski »

*

MB Themes

Re: Show banners by country by js code (9 field)
« Reply #1 on: June 13, 2018, 01:31:18 PM »
Hello
Theoretically yes, if you complete that code.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Re: Show banners by country by js code (9 field)
« Reply #2 on: June 13, 2018, 07:11:14 PM »
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.

*

MB Themes

Re: Show banners by country by js code (9 field)
« Reply #3 on: June 13, 2018, 09:02:33 PM »
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...
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Re: Show banners by country by js code (9 field)
« Reply #4 on: June 14, 2018, 07:49:23 PM »
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...

*

MB Themes

Re: Show banners by country by js code (9 field)
« Reply #5 on: June 14, 2018, 08:48:04 PM »
That could be secured from php side, but such geolocation use to be not accurate.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots