Zum Inhalt springen

Liquid in in-apps

Dieser Inhalt ist noch nicht in Ihrer Sprache verfügbar.

Write Liquid in the content of an in-app to show each user their own data: their Tag values, the attributes of the event that triggered the in-app, and their User ID. For example, greet the user by name and show the promo code passed in the event.

Where Liquid works in in-apps

Anchor link to

Liquid works only in an in-app that a journey shows with the In-App element. Both Show in-app modes work: On next app launch and On event.

Write the Liquid in one of these places:

  • The text of a built-in editor block, such as an HTML block or a Text block. Text in every language of the in-app works.
  • The index.html file of an uploaded HTML archive.
  • A text field of a native in-app.

Add Liquid to an in-app

Anchor link to

To add Liquid, write it in the in-app editor, then select the in-app in a journey.

  1. Open the in-app in the built-in editor.

  2. Add an HTML block, or select an existing one.

  3. In the HTML field, type the Liquid code by hand.

    HTML block settings in the in-app editor with Liquid code that greets the user by firstName, shows the loyalty_tier Tag in upper case, the promo_code event attribute, and an if condition for the gold tier
  4. Click Save.

  5. In the In-App element of your journey, select the in-app in Media Source.

  6. If the in-app uses event attributes, choose On event in Show in-app and select the event.

The editor preview shows the Liquid code as written. Each user sees their own values.

In this example, firstName and loyalty_tier are Tags, and promo_code is an attribute of the event that shows the in-app:

<h2>
Hi, {{ firstName | default: "there" }}!
</h2>
<p>
Your {{ loyalty_tier | upcase }} code:
<b>{{ promo_code }}</b>
</p>
{% if loyalty_tier == "gold" %}
<p>Shipping is on us today.</p>
{% endif %}

Data you can use

Anchor link to

These values are available in the Liquid of an in-app:

ValueWhat it isHow to write it
TagA piece of user data stored in Pushwoosh, such as the user’s name. The in-app shows the value it has when the in-app is shown.{{ loyalty_tier }}
Event attributeAn attribute of the event selected in On event mode of the In-App element. If an attribute has the same name as a Tag, the attribute value is used.{{ promo_code }}
User IDThe ID your app assigns to the user.{{ userid }}, in lowercase
HWIDThe hardware ID of the user’s device in Pushwoosh.{{ hwid }}, in lowercase

Write variable names

Anchor link to

Follow these rules when you type a variable name:

  • Type the name exactly as it is in Pushwoosh, including capital letters. A name that doesn’t match, for example {{ firstname }} for the Tag firstName, shows as empty text.
  • Write Tag and attribute names without spaces: {{ LoyaltyTier }} for a Tag named Loyalty Tier.
  • To show a fallback instead of empty text, add the default filter: {{ firstName | default: "there" }}.

Change how a value looks

Anchor link to

To change how a value looks, add a Liquid filter. All standard filters work, for example upcase, capitalize, date, and truncate, and so does the Pushwoosh timezone filter.

Limitations of Liquid in in-apps

Anchor link to

In an in-app, Liquid has these limits:

  • If you send the in-app as an Instant in-apps campaign (Campaigns > Instant in-apps), Liquid isn’t applied and users see the code as written. Use Dynamic content placeholders instead.
  • {% include %} isn’t supported. Write the full code in the in-app itself.
  • Connected content isn’t supported. Use the values from Data you can use instead.
  • If the in-app archive is larger than 1 MB, Liquid isn’t applied and the user sees the code as written.
  • If the Liquid code has an error, for example an unclosed {% if %}, the user sees the in-app with the code as written. Check the in-app on your own device before you launch the journey.