{{ client_permissions }}

The client_permissions object is available on every page, and contains information about whether or not the user (or developer) has granted permission to use specific features. By default the only feature controlled by this is sessions, but the permission system may be "extended" arbitrarily by the developer to control additional features.

The permissions feature requires cookies in order to work. Requests made without cookies (such as by bots or browsers with cookies disabled) will always behave like an initial page-load without existing permission information.

Properties

string object_type
Will always be "client_permissions".
true/false is_valid
Will always be true.
string cookiename
The name of the cookie used for storing permissions. Will always be "_mp_permissions".
true/false has_cookie
True if the permissions cookie was already set prior to this request. False on the first page load, after the client has cleared their cookies, or on all requests from browsers with cookies disabled.
date cookie_expires
The date and time that the permissions cookie is set to expire.
date min_permission_expiration_date
The next date and time that one of the permissions is set to expire. Note that this does not distinguish between "allow" and "deny" permissions and will ignore permissions with no expiration date set. If there are no permissions with expiration dates set this property will be empty.
date max_permission_expiration_date
The latest date and time that one of the permissions is set to expire. Note that this does not distinguish between "allow" and "deny" permissions and will ignore permissions with no expiration date set. If there are no permissions with expiration dates set this property will be empty.
true/false do_not_track
Whether or not the browser sent the "DNT" header in the request.
permission *
You can use this object to access individual permission settings.
true/false allow_*
Shortcut which returns true if the specified permission is defined AND allowed in the permission system.

Individual permissions may be accessed using {{ permissions.permissionName }} or {{ permissions['permissionName'] }} syntax.

Shortcuts may also be accessed using {{ permissions.allow_permissionName }} or {{ permissions['allow_permissionName'] }} syntax.

Examples

{% if client_permissions.do_not_track %}
    <p>You have requested that we do not track your information. We interpret that to mean __x__ and so will return a __y__ generic response.</p>
{% else %}
    {% if client_permisions.allow_all %} --in this example "all" refers to a custom permission defined by the developer
        <p>You have granted us unlimited power! You should have the best possible experience.</p>
        {% if client_permissions.all.expires < request.date | add_weeks: 2 %}
            <p>Your permissions will expire on {{ client_permission.all.expires | date: 'MMM dd' }}. If you want to continue receiving the best possible experience, <a href="#">follow these instructions</a></p>
        {% endif %}
    {% else %}
        {% if client_permissions.allow_generous %}
            <p>You have allowed "generous" permissions. While not the best, this still allows for a good experience.</p>
        {% elsif client_permissions.allow_limited %}
            <p>You have allowed "limited" permissions. This is only slightly better than a completely anonymous experience.</p>
        {% else %}
            <p>You have not allowed any permissions. Your experience will be fully generic.</p>
        {% endif %}
        <p>To customize your options and improve your experience, <a href="#">click here</a>.</p>
    {% endif %}
{% endif %}

Developer Overview

Liquid Markup