Geolocation meets Drupal in a big way with a fresh suite of modules for interfacing Drupal with Quova’s geolocation offerings. Quova is the worlds largest geolocation provider powering over 95% of the worlds location searches.

The Quova suite of Drupal modules provides the following features:

  • Quova Core - Provides an API to interact with the Quova IP Info service, and helpers for location based customizable content.
  • Quova Context - Built in context support allows you to use country as a context argument.
  • Quova Locale - Provides automatic language switching based on the users country and region.
  • Quova Weather - Integrates with the Weather module to provide a block showing weather at the users current location.
  • Rules - Built in rules support allows you to use country as a rules condition allowing location based site customizations or geofencing.
  • Views / Location - Built in helpers to allow you to interface easily with Views and the Location module.
  • Ad - Allows geotargeting of advertising using Quova and the Ad module.

Using the Quova API

The core Quova module (quova.module) provides a number of public facing functions:

//  Super fast wrapper to access county, state, city, lat and long data.
$geo = quova_quick();
echo sprintf("You are in %s, %s, %s at (%s, %s)", $geo->city, $geo->state, $geo->country, $geo->latitude, $geo->longitude);

// The main entry point for developers
// Note: The results of the quova query are cached both statically and in Drupal's cache tables for each IP address.
$geo = quova_ipinfo_request();
echo $geo->ipinfo->Location->CityData->city;
echo $geo->ipinfo->Network->line_speed;

// A quick helper for the Location and Views module
list($latitude, $longitude) = quova_latlong();

These functions behave in the same way that quova_ipinfo_request() does, however may be useful for integration.

  • quova_ipinfo: returns the object obtained from Quova's IP Info JSON service.
  • quova_ipinfo_raw: returns the raw headers and response from Quova's IP Info service.
  • quova_ipinfo_cached: returns the raw ipinfo object from drupal's cache table (not statically cached).

Geocontent

You can use the quova_quick function to easily provide geotargeted content (geocontent) to your users by enabling the PHP filter for your post. Take a look at this example of a shipping information page:

<h2>Shipping information</h2>

<?php if (quova_quick()->country = 'united states'): ?>
    <p>Within the US we aim to deliver within 2 business days.</p>
   
    <?php if (quova_quick()->city = 'mountain view'): ?>
        <p>Hey we noticed you're in <strong>Mountain View</strong> too, why not drop in to our local office?</li>
    <?php endif; ?>
<?php elseif (quova_quick()->country = 'united kingdom'): ?>
    <p>It looks like you're in the United Kingdom, unfortunately at this time we are not allowed to ship our products to you.</p>
<?php else: ?>
    <p>We ship anywhere in the world within 5 business days.</p>
<?php endif; ?>

Quova Context

This submodule provides a context plugin allowing you to use the users country and line-speed as a context condition. This allows easy customisations to improve your sites accessibility, for example the linespeed could used to adjust your css or swap in low bandwidth sidebar blocks. The country context could be used to swap in locale or language sensitive content.

Quova Locale

This submodule allows you to automatically switch interface languages based on the users location -- simply enable the module and use the Detection and Selection tab in the Languages administration section.

Quova Weather

This submodule allows you to interface with the Weather module to provide geotargeted weather information -- blocks can be added through the block interface.

Using Rules

The core module provides support for Rules -- this allows you to set up complex conditions for displaying messages, geofencing, or automatic payment engine selection using Drupal Commerce.

Using the Location and Views modules

You can easily enhance content by displaying items of geographical significance to the user, e.g. sorting a list of branches by the users current location. To do this, add a Distance / Proximitysort field and configure it.

Geotargeted Advertising

Quova provides a plugin for the Ad module. The settings can be configured through the Ad administration page.