Geolocation DKI

Use Geolocation DKI shortcodes to display the visitor’s location - country, state, city, or continent.

Demo

People in California love If-So!

Your location name in the above example is displayed using theGeolocation DKI Shortcode. Your location is detected using our IP-to-location service.

The Geolocation DKI shortcodes

Applying the geolocation shortcode is as simple as generating it with the generator below and pasting it on your site.

The shortcode below was used to create the demo at the top of this page. It includes all available attributes:

[ifsoDKI type="geo" show="country" ajax="yes" fallback="your country" before="users in" after="love If-So!"]

You can use the shortcode in any field that accepts shortcodes, or include it via a simple PHP line in your theme files.

Available shortcode attributes

  • show – Choose the type of location you want to display: continent, country, state, city, or time zone.
  • ajax (optional) – Set to yes if your site uses caching. The location name will be loaded in a separate AJAX request after the cached content finishes loading.
  • fallback (optional) – By default, the Geolocation DKI shortcode does not display anything if no value is returned by the IP-to-location database (typically when sessions are exhausted or, in rare cases, when the user’s IP is not recognized). Set this parameter to display an alternative value.
  • before / after (optional) – Text to display before and/or after the location name. Alternatively, place the shortcode in the middle of a sentence.

Geolocation DKI Shortcode Generator

Use the shortcode generator below to generate your Geolocation DKI shortcode:

Geolocation

Set ajax to “yes” if your site uses caching.
Shown if dynamic value is unavailable.
Shown only if a dynamic value is available (ignored in fallback content).
Shown only if a dynamic value is available (ignored in fallback content).
City-level accuracy notice

IP-to-location services (all providers, not just If-So) are not 100% accurate. Accuracy is generally high at the country and state levels, but it becomes more variable at the city level.

If you use the city-level Geolocation DKI shortcode, consider enabling our HTML5 Geolocation API or offering a manual self-selection option. The first approach improves accuracy, while the second lets users correct their location when needed.

FAQs

  • Can the Geolocation DKI Shortcode display location names in languages other than English?

    The DKI shortcode retrieves values directly from our IP-to-location database and is limited to displaying location names in English. However, our CSV extension offers a solution:

    1. Ensure the CSV extension is installed on your site.
    2. Download our “All-countries” CSV file (click to download).
    3. Insert the desired language’s location names in column D.
    4. On your WP dashboard, create a new bulk with a geolocation condition and upload the file.
    5. Paste the CSV shortcode, displaying values from column D, wherever you want to show the country name on your page.

Was this Helpful ?

    We're sorry couldn’t be more helpful ☹️

      Ready to get started?
      Try it on your website