{{ client }}

{{ client }}

The client object is available on every page, and contains information about the history of the browser used to access the site. Note that most of these properties are only meaningful if the user has allowed permission for sessions.

Additionally, client properties require cookies in order to work. Requests made without cookies (such as by bots or browsers with cookies disabled) or without permission for session will always behave like an initial page-load without existing client information.

The client object is one of a handful of simple mechanisms to enable personalization on your site. Used well, these can be powerful tools for developers and website owners.


Field Type Description
object_type string Will always be "client".
is_valid true/false Whether or not the user (or developer) has granted permission for a session.
allowed true/false Alias of is_valid.
id string The unique identifier for the client browser. If the user does not have permission for a session this will be empty.
user_agent string The user-agent string sent with the request. This is an alias of request.user_agent.
first_request_date date The date that we received the first request from this client. Note that this is dependent on a number of outside factors, including the client's use (and/or clearing) of cookies and their allowance of sessions.
num_requests number The total number of requests made by this client since the first_request_date.
num_pages number The total number of successful page requests made by this client since the first_request_date.
num_sessions number The total number of sessions created for this client since the first_request_date.
permissions client_permissions The permissions that are set for the current client. The shortcut for this is {{ client_permissions }}.
session session The current session for the client. The shortcut for this is simply {{ session }}.
cookies cookies The cookies for the current client. This is an alias of {{ request.cookies }} and the shortcut for this is {{ cookies }}.
properties list The full list of custom properties that are set for the current client. Note that this list only includes the keys, the values will have to be retrieved using the keys.
max_properties number

The maximum number of properties that may be saved to the client.

Individual custom properties for the client may be accessed using {{ client.propertyName }} or {{ client['propertyName'] }} syntax.

You should be aware that you may only save a limited number of properties to the client object. Adding new properties beyond that limit will result in the oldest properties being "forgotten". The default limit to the number of properties is currently 100. If you need more than 100 client properties contact Marketpath about raising your limit.

You may also treat this object as a list containing all of the property names which may be iterated using a {% for %} loop. For more details, see the examples below:


First client Session

{% if client.allowed and client.num_sessions == 1 %}

This is your first session {% if session.first_page %}AND your first page!{% endif %}

{% endif %}

Client Number of Sessions within a year

{% if client.allowed and client.num_sessions > 6 and client.VIP != "true" and client.first_request_date < request.date | add_years: -1 %}

You have viewed this site {{ client.num_sessions }} since {{ client.first_request_date | date: 'MMMM yyyy' }}. During that time you have looked at {{ client.num_pages }} pages. We are happy that you have taken so much interest in us, and would like to invite you to join our VIP club!

{% endif %}

List all custom properties for the current client


Client Properties:

    {% for property in client %} --equivalent to {% for property in client.properties %}
  • {{property}} = {{ client[property] }}
  • {% endfor %}

Working with specific custom properties

{% if client.is_valid %} {% if client.custom_property_name %}

Custom Property: {{client.custom_property_name}}

{% endif %} {% if client['custom_property_name_2'] %}

Custom Property 2: {{client['custom_property_name_2']}}

{% endif %} {% endif %}