{system_visitordeviceclass}

Description

The module {system_visitordeviceclass} will display the type of device a site visitor is using. Its possible values are desktop, phone and tablet. If the device type cannot be determined the system will use desktop as the default value.

You can use system_visitordeviceclass to render a particular content holder or using a different stylesheet depending on the site visitor's device, see the Deploying your site across Mobile and Tablet devices article for more configuration samples.

Syntax

{system_visitordeviceclass 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.deviceClass

Examples

  • {system_visitordeviceclass} - will display tablet if the site visitor is using a tablet to view the site
  • {module_captchav2 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 device type 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

{system_visitordeviceclass}

Examples

  • {system_visitordeviceclass} - will display tablet if the site visitor is using a tablet to view the site.