What are template tags?
ℹ️ Note: The template tags are applied to the creative template. If you are looking to modify product data on the feed, please refer to the "Feed fields in dynamic ads" -article.
Template tags make it possible to dynamically populate parts of your creative with information from your Facebook catalog.
For example, if you used template tags in the message section of a creative like this:
Get {{product.name}}
now for only {{product.current_price}}!
The result would be:
"Get Pants for Dogs now for only $12.99!" or "Get Tomato Ice Cream now for only $2.99!".
A template tag can be identified from double curly braces ( {{ ), but you don't have to remember them all. To see a list of all the available options, click the Template Tags button and select the one you want to use.
Modifiers in template tags
By default, Facebook applies various kinds of formatting to catalog fields. In some cases, you might want to display the information in a format more suitable for your target audience. Or if you're using catalog information to build link URLs, they have to match exactly the convention defined on your website.
For example, if the price of your product is in US dollars and you need it in euros, you could use the following modifier called raw to remove the original currency symbol and add a static "€"
:
"Only €{{product.price raw}} for all of October!"
The result would be:
"Only €20.00 for all of October!" or "Only €55.00 for all of October!"
Available modifiers
Transforms
Example usage: {{product.name | titleize}}
Option | Description | Example |
---|---|---|
number_format |
Format the number in default format, using comma (, ) as thousand separator, rounded to the nearest integer. The value to format must be an unformatted number (1234 , not 1,234 ). |
1234.56 → 1,235 |
titleize |
Capitalize the words for a better looking title | organic banana → Organic Banana |
urlencode |
Encode the value to be used as a part of a URL. | http://smartly.io → http%3A%2F%2Fsmartly.io |
Price modifiers
These transforms work for the price fields such as price
and current_price
.
Example usage: {{product.price raw strip_zeros}}
Option | Description | Example |
---|---|---|
raw |
Omits the currency symbol | $32.00 → 32.00 |
strip_zeros |
Omits the cents part in currency if cents are zeros | $32.00 → $32 |
round |
Omits the cent amount of the currency while rounding up the price. | $12.98 → $13 |
Common examples for price modifiers
Using a different currency symbol:
{{product.current_price}}
→$9.99
{{product.current_price raw}}€
→9.99€
Date format
These are available for dates, mostly used in Travel Ads.
Example:
{{trip.checkin_date}}
→October 10th
{{trip.checkin_date date_format:Y-m-d}}
→2018-10-10
List of available formats here.