Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

168
Visualizações
Limit the number of times my code is loaded on a web page based on geo targeting - javascript

I have a problem.

I have a piece of code, that I send to websites to be placed inside the <head></head> right at the very beginning of the header. My code will run and collect some data and pass the result to the rest of the page (ad servers, forms, etc., for example).

My problem is that I need to limit the number of times this code can make calls back to my server and that needs to be based on user location (city, more specifically). I cannot use the ad server, and benefit from its targeting capabilities because I do need to run this code before everything else.

I was thinking if there was any sort of script that would allow me to identify the user location and make the decision to whether or not to call my server, therefore making sure that I am only using my resources when it is actually needed.

I thought about using the html5 geolocation API but it requires user interaction. Then I was thinking about using a service like IpRegistry.co, to:

  • query for the location and if ;
  • location=desired location;
  • then load javascript code;
  • otherwise do nothing;

I am not sure if this is possible and how to do it. Any help would be greatly appreciated and desired. I am ready to explore opportunities here.

If I didn't stress enough, it needs to happen inside the header, not on the body.

Thanks in advance.

PC

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda