{module_visitorcountrycode}

Description

The module {module_visitorcountrycode} will display the 2-letter country code of the current visitor. So if the visitor is from Australia, it'll display 'AU', if they are from the US, it'll display 'US'. So using some basic JavaScript you can direct anyone who is from Australia to one page, or to a blank page, or to an external site, and direct everyone else to your actual site.

Syntax

{module_visitorcountrycode collection="my_custom_collection_name" template=""}

Note: When using named parameters always wrap the individual parameters in double quotes. Also, do note that modules using named parameters do not work for campaigns just yet.

Parameters

This module can be rendered:

  • in plain text
  • using Liquid collections - this is the Liquid output tag you can use - my_custom_collection_name.countryCode

Examples

  • {module_visitorcountrycode} - AU
  • {module_visitorcountrycode collection="collection1" template=""} - in this case nothing will be displayed, however the module's Liquid tags will become available in the collection1 collection
  • the site visitor's country code is also contained in a Liquid global object. {{globals.visitor}} will output:
    {
      "deviceClass": "desktop",
      "ip": "193.2.2.2",
      "country": "RO",
      "userAgent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36"
    }

Syntax

{module_visitorcountrycode}

Examples

  • {module_visitorcountrycode} - AU