Skip action for a contact
Overview
When using dynamic content for personalization it is important to check to make sure that any content that you want to display to the user is in fact available. In other parts of our documentation, you'll find examples for how to provide defaults for contact properties, lookups, and event data.
There are situations where you may not want to take any action for a contact if a piece of content is not available. It is generally recommended to handle this as far upstream as possible, e.g. using segment criteria to require that the relevant contact property exists. However, in some situations this is not possible, such as when it depends on the value of a lookup table or the data is from an event property.
skip_action is not supported in Stream Flows, Data Feeds, nor Journeys Metadata
Using Skip action
When you detect a condition for which it does not make sense to take any action for that contact, you can use skip_action
. When used in a template, block, custom context, or message it will result in no action being taken for that contact. The syntax is as follows: {{ skip_action() }}
.
The call also supports an optional reason: {{skip_action('missing data')}}
.
The below example shows how it could be used when there is no result for a lookup using the contact's recommended SKU.
{% if contact.recommended_sku and lookups.product_catalog[contact.recommended_sku].description -%}
{{- lookups.product_catalog[contact.recommended_sku].description -}}
{%- else -%}
{{ skip_action('product not found') }}
{%- endif %}
Updated about 2 months ago