Geo-target Landing Pages: City or Zip Code Level

No matter if you’re running AdWords/Facebook PPC campaigns, media buys, or using CPV (PPV) marketing–using targeted landing pages is a sure way to shoot up your conversions!

One of the best ways to laser-target your landing pages is to include the visitor’s city name on your landing page. How you do it depends on your creativity. For example, “special deal only for Austin visitors! ;-)”. There are also certain other cases where it helps immensely, e.g., ad approval on AdWords.

This PHP script performs IP to city and IP to zip code lookups using MaxMind GeoLiteCity database, which is about 95%+ accurate.


  1. Download this file. Click on File->Download or just press CTRL+S.
  2. Extract it. You should get three files;, geoipregionvars.php and index.php.
  3. Upload them to your web host. Place them either in the root directory (like or in a sub-directory like
  4. Download this file. You should get GeoLiteCity.dat file after extracting.
  5. Upload this file to the same directory where you uploaded the previous three files.
  6. Open index.php file in your file manager. You can edit it according to your needs, I have given hints inside this file.

You can modify index.php to do the following tasks:

  • Display visitor’s city name or postal/zip code. Embed the code in your landing page with rest of the HTML code.
  • Redirect based on city
  • Redirect based on postal or zip code

If you want redirection for more cities, just add them in the script. Comment below if you need any help! 🙂