{{ client_permissions }}

{{ 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

Field Type Description
object_type string Will always be "client_permissions".
is_valid true/false Will always be true.
cookiename string The name of the cookie used for storing permissions. Will always be "_mp_permissions".
has_cookie true/false 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.
cookie_expires date The date and time that the permissions cookie is set to expire.
min_permission_expiration_date 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.
max_permission_expiration_date 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.
do_not_track true/false Whether or not the browser sent the "DNT" header in the request.
* permission You can use this object to access individual permission settings.
allow_* true/false

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

Client Permissions

Copy
{% if client_permissions.do_not_track %}

You have requested that we do not track your information. We interpret that to mean __x__ and so will return a __y__ generic response.

{% else %} {% if client_permisions.allow_all %} --in this example "all" refers to a custom permission defined by the developer

You have granted us unlimited power! You should have the best possible experience.

{% if client_permissions.all.expires < request.date | add_weeks: 2 %}

Your permissions will expire on {{ client_permission.all.expires | date: 'MMM dd' }}. If you want to continue receiving the best possible experience, follow these instructions

{% endif %} {% else %} {% if client_permissions.allow_generous %}

You have allowed "generous" permissions. While not the best, this still allows for a good experience.

{% elsif client_permissions.allow_limited %}

You have allowed "limited" permissions. This is only slightly better than a completely anonymous experience.

{% else %}

You have not allowed any permissions. Your experience will be fully generic.

{% endif %}

To customize your options and improve your experience, click here.

{% endif %} {% endif %}