Enable JavaScript property

Enable JavaScript Property

Geo Controller includes optional JavaScript features that provide real-time geolocation control in both frontend and admin areas. When enabled, the plugin loads helper scripts that expose geolocation data to the browser via two global JavaScript objects: cf.geoplugin and window.cfgeo.

These objects contain all geo information detected by the plugin, such as city, state, country, IP address, and more. You can use this data in your custom JavaScript to adjust the content, UI behavior, or trigger additional scripts based on the visitor’s location.

JavaScript support is available from version 5.2.0 and is useful when working with dynamic content, AJAX-loaded elements, or when you need instant access to geo data without a page reload.

Example usage:

<script>
    // Look in your browser console for the available data
    console.log(window.cfgeo);

    // Example: Use geo data anywhere in your custom scripts
    var city    = window.cfgeo.city,
        state   = window.cfgeo.state,
        country = window.cfgeo.country,
        ip      = window.cfgeo.ip;
</script>

Note: If disabled, JavaScript-based geo logic and objects will not be available. Keep this enabled if you’re building advanced interactions or integrations that depend on geolocation.

Was this page helpful?