Merge tags and variables

Use merge tags to personalize you campaigns foreach subscriber.

Using merge tags in campaigns you can customize its message for each subscriber. This feature is very simple to use, simply enter a word surrounded by braces.

In the above example the word surrounded by braces is the merge tag that represents the value of a tag that when processing the campaign will be replaced with the value of that tag associated for each subscriber. If the subscriber does not have that tag then nothing will be put in place of the tag.

So for the above message, if we have subscribers that contain a first_name tag like the one below:

This is the message that the subscriber will see:

Default values

The merge tags syntax allows you to add a default value that will be displayed if the subscriber’s tag list do not contain the specified merge tag. You can use a default value by adding | after the merge tag and then specify the default value.

Example:

Hello {first_name|friend}

In the example above, if the subscriber to whom the campaign is to be sent does not have a tag with the key first_name then the default value friend will be displayed.

Subscribers cart

You can use merge tags to display certain values any from subscriber shopping cart. Here you can use a special syntax that uses “dots” which allows traversing the cart object.

Example:

{$cart.items.0.title}

In the example above, the merge tag will be replaced with the title of the first product in the subscriber’s shopping cart.

To better understand this syntax we need to take a look at the cart object.

{
  "items":[
     {
        "id":6622730715345,
        "title":"Lavazza Il Mattino cafea macinata 250g",
        "link":"https://cafeo-test.myshopify.com/products/lavazza-il-mattino-cafea-macinata-250g?variant=39648584237265",
        "price":"10.5 RON",
        "totalPrice":"10.5 RON",
        "image":"https://cdn.shopify.com/s/files/1/0572/2416/7633/products/lavazza_il_mattino_moulu_250g-1.jpg?v=1621413031",
        "quantity":1,
        "variant_id":39648584237265
     },
     {
        "id":6622678253777,
        "title":"PACHET 8 x Morra Espresso cafea boabe 1kg",
        "link":"https://cafeo-test.myshopify.com/products/pachet-8-x-morra-espresso-cafea-boabe-1kg?variant=39648437371089",
        "price":"519.2 RON",
        "totalPrice":"519.2 RON",
        "image":"https://cdn.shopify.com/s/files/1/0572/2416/7633/products/morra-pentru-site-bax-v2.png?v=1621410643",
        "quantity":1,
        "variant_id":39648437371089
     }
  ],
  "totalPrice":"529.7 RON",
  "itemCount":2,
  "uniqueItemCount":2
}

The syntax must contain $cart, a dot . and any key from the cart object. If the key is an object itself that contains other keys the same analogy can be applied to go deeper into the object.

Available cart variables

Here you have a list of all available cart variables that can be used as merge tags:

  • items : represents a list of all products from the cart. If you want to access a particular item from the cart you can add a number after the items variable. This number represent an index of the items list. If you use an index then you have access to the following variables:

    • id;
    • title;
    • link;
    • price;
    • totalPrice;
    • image;
    • quantity;
    • variant_id;

Usage Examples:

   {$cart.items.2.id}
   {$cart.items.2.title}
   {$cart.items.2.link}
   {$cart.items.2.price}
   {$cart.items.2.totalPrice}
   {$cart.items.2.image}
   {$cart.items.2.quantity}
   {$cart.items.2.variant_id}
  • totalPrice: represents the total price of the products in the shopping cart.

Usage Example:

   {$cart.totalPrice}
  • itemCount: represents the total number of products in the shopping cart.

Usage Example:

   {$cart.itemCount}
  • uniqueItemCount: represents the total number of unique products in the shopping cart.

Usage Example:

   {$cart.uniqueItemCount}

Last product view

If you want to send campaigns that contain information about the subscriber’s last viewed product you can use $last_product_view variable. This variable allows you to access properties like:

  • Properties and usage:
   {$last_product_view.title}
   {$last_product_view.price} // e.g. 120 USD, 100 EUR, based on each subscriber`s presentment price
   {$last_product_view.old_price}
   {$last_product_view.currency}
   {$last_product_view.stock}
   {$last_product_view.image}
   {$last_product_view.link}

Updated Product (dynamic)

If you want to build automations that inform subscribers about a price drop, price increase or a back in stock product event, you can use the $product variable to access the updated product’s properties.

  • Properties and usage:
   {$product.title}
   {$product.price} // e.g. 120 USD, 100 EUR, based on each subscriber`s presentment price
   {$product.old_price}
   {$product.currency}
   {$product.stock}
   {$product.image}
   {$product.link}

– only for a Price dropped triggered automation

  {$product.price_drop_percentage}%
  {$product.price_drop_value}

– only for a Price increased triggered automation

  {$product.price_increase_percentage}%
  {$product.price_increase_value}

Profile

If you want to send campaigns that contain information about the subscriber, you can use the $profile variable:

  • Properties and usage:
   {$profile.firstname}
   {$profile.lastname}
   {$profile.email}
   {$profile.phone}