DM Visitor Location Notification

DM VLN allows you to display notification for new visitors on a page with location details and stats with top 10 countries for that page.


The plugin uses to get visitors details based on IP.
You will need an API key from in order for it to work.

On activation the plugin creates a DB table called dm_visitor_location with the columns: IP, Time, Continent, Country, Country_Code, City, Post_ID, id.
The IP is grabbed with a PHP function at the plugin level and passed to the API request to IPStack, returning the Continent, Country, Country_Code and City.

For that to happen you will need to use [dm-vln-notification] on the page you want to show the notification.

The function behind the shortcode will get the IP, check if the IP exists in the DB for the current Post_ID. If the IP doesn’t exists associated with the current Post_ID it will save/create it. If the record already exits it will only update the timestamp.

The record exists if the IP and the Post_ID match.

This check is done in order to save API requests, only updating the timestamp on the IPs that were already sent via the API request.

Example: if the same IP returned to the same Post_ID that it was visited before, we only update the timestamp, we don’t create a new record.
If that IP visits a different Post_ID, we’ll create a new record with the new Post_ID.

Based on these records we display the notification that someone is on the page with that Post_ID.


Two shortcodes are available for use:

  • [dm-vln-notification] – this one will check the visitor details and create/update the records and show the notification message.
  • [dm-vln-top-countries] – this one will show the top 10 countries that visited the page (only unique IPs will be counted).

The [dm-vln-top-countries] can’t provide correct data if [dm-vln-notification] was not added to that page at one point.
Since [dm-vln-notification] does the whole operation regarding visitor data display, save and update.


Dashboard page provides you with a number of options:

  • Adding API Key
  • Choose the position of the notification
  • Style the color scheme for the notification
  • Add Custom notification message for single and multiple users
  • Adjust the Notification display time
  • Adjust the Frequency of the Ajax call
  • Set the seconds for with to check the DB (based on NOW – seconds we decide what users are new/online)
  • Pause the API Request
  • Select a date and delete DB records previous to that

Custom Notification Message

Custom notification messages can be adjusted using dynamic variables.
For Single visitor you have:

  • %dm_vln_country% – displays the country with the flag
  • %dm_vln_city% – displays the city (it is not 100% accurate).

For Multiple visitors you have:

  • %dm_vln_visitor_number% – shows the number of visitors
  • %dm_vln_countries% – displays list of country codes
  • %dm_vln_flags% – displays list of flags instead of country codes
  • %dm_vln_country_flags% – displays list of country codes associated with the flag.

You should only use one of the %dm_vln_countries%, %dm_vln_flags%, %dm_vln_country_flags% or it will show you duplicate data.

In all custom message you can use HTML tags.