There are two kinds of dynamic content that you can add to your brand’s text messages: dynamic links and variables (macros).
- Dynamic links let you personalize text messages with personalized links to pages on your website.
- Variables let you personalize text messages with details like subscriber name, product details like name and price, discount codes, and more. Variables also support default values, which use generic, inclusive terms when personalized details (like name) aren’t available, like “friend" instead of the subscriber's first name.
Note: Some variables and dynamic link types can only be used with certain journey types and may require that you already share product data with Attentive. For example:
- Variables can’t be used with messages in welcome journeys. This helps ensure that welcome messages are always sent in a timely manner when a subscriber opts in to receive messages from you.
- The {{triggerEvent.product.priceDropPct}} variable can be used in Price Drop journeys.
- Dynamic links to recommended products can only be used if you’re sharing your product data with Attentive.
Note: When you send a preview text message, dynamic links and variables aren’t resolved in the sent test text message. For example, if you include the {{subscriber.firstName}} variable, you’ll also see {{subscriber.firstName}} in the test message. You can use preview options to preview how variables will appear to your subscribers.
Add a dynamic link or variable to a message
Follow these steps to add a dynamic link or variable to a message:
- In a campaign text message or send text message step in a journey, move your cursor to where you want to add a dynamic link or variable, then click .
- In the Insert variable popup, click Variable.
- Select a Category
- Click Subscriber to view dynamic links and variables associated with subscribers.
- Click Product to view dynamic links and variables associated with product data.
- Click the link or variable you want to use.
- (Optional) Add a Default value (also called a fallback). For example, if your {{subscriber.firstName}} variable has “friend” as the default value, a message will say “friend” if the subscriber’s first name is unavailable.
- Click Insert.
Notes:
- Some dynamic elements are only available in certain journeys and require that you share product data with Attentive.
- If you don’t add a default value and data isn’t available for a subscriber, a message won’t be sent to that subscriber.
Dynamic link and variable object names
You can add dynamic links and variables to a message by using the personalization button in the message editor. Dynamic links or variables added to a message use the object names listed below. If you add a dynamic link or variable by typing it out, be sure to use the current object name.
Dynamic links
{{subscriber.cartLink}}
Link to the subscriber's cart. Previously: {cartLink}
Note: The {{subscriber.cartLink}} dynamic link works best for brands on Shopify. If your brand isn’t on Shopify, you can still use this dynamic link, but your subscribers may not see their saved shopping cart when they click the link., For example, they may not see their saved cart if they open the link on a different device or in a different browser from when they originally added items to their cart. See Use Cart URL personalizations in journey messages for more information.
{{subscriber.signupOffer.link}}
Link that automatically applies the discount code at checkout. Previously: {couponLink}
{{subscriber.signupOffer.couponScreenLink}}
Link that directs the subscriber to the Attentive-hosted offer screen where they can copy the discount code and be taken back to their last browsed page. Previously: {couponScreenLink}
{{offer.link}}
Link that automatically applies the discount code at checkout. Previously: {couponLink}
{{triggerEvent.product.link}}
Link to a product page. Previously: {productLink}
{{triggerEvent.checkout.checkoutLink}}
Link to checkout page. Previously: {checkoutLink}
Note: To include UTM parameters in dynamic links for messages in custom event journeys, make sure the custom event payload sent to Attentive already contains these parameters.
Dynamic variables
{{offer.code}}
Offer code (e.g., ATTV-OLCHY8). Previously: {coupon}
{{offer.value}}
Offer value (e.g., $10 or 10%).
Note: The offer must have a Discount amount (optional) set up if you want to add the {{offer.value}} variable to a message. For more information, see Create offers.
{{subscriber.signupOffer.code}}
Sign-up offer code. Previously: {coupon}
{{subscriber.firstName}}
Subscriber's first name. Previously: {firstName}
{{subscriber.fullName}}
Subscriber's full (first and last) name. Previously: {fullName}
{{subscriber.lastName}}
Subscriber's last name. Previously: {lastName}
{{triggerEvent.product.image}}
Image of the product. Previously: {productImage}
{{triggerEvent.product.name}}
Product name. Previously: {productName}
{{triggerEvent.product.price}}
Product price. Previously: {productPrice}
{{triggerEvent.product.quantity}}
Product quantity. Previously: {{productQuantity}
{{triggerEvent.product.priceDropPct}}
Price drop as a percentage. Previously: {priceDropPct}
Character counts with dynamic content
Keep in mind that when you add dynamic content, the final character count for each message varies depending on the values populated for each subscriber. See How message character counts are calculated with Campaign Composer for more information.
Choose a default value for variables
You can choose a default value for variables. A default value is a value that appears when the variable has no value. For example, you might want to set “friend” as a default value for the subscriber first name variable. This way, if a subscriber’s first name is unknown, Attentive will populate “friend” for the subscriber first name variable instead of leaving it blank in the message.
When you add a variable to your message, enter the default value in the Default value (optional) field; then click Insert.
The variable with the default value appears as follows in the editor:
{{variableName | default:”default value”}}
Examples
Hey {{subscriber.firstName | default:”friend”}}, we have your perfect shade in stock!
The message above appears to subscribers as follows:
Hey Jane, we have your perfect shade in stock!
If the subscriber's first name is unavailable, the message appears to subscribers as follows:
Hey friend, we have your perfect shade in stock!
How do you like your new {{triggerEvent.product.name | default: “item” }}?
The message above appears to subscribers as follows:
How do you like your new Downpour Rain Jacket?
If the product name is unavailable, the message above appears to subscribers as follows:
How do you like your new item?
Add variables to links
You can add variables to links in your text messages to send your subscribers to unique URLs. For example, you can use variables for enhanced link tracking, send subscribers to personalized landing pages, and take better advantage of certain apps. See Add variables to links in campaign messages and Add variables to links in journey messages for more information.
Use a custom attribute as a dynamic variable
If you use custom attributes to collect data about subscribers, you can add custom attributes to text messages as dynamic variables.
Follow these steps to add a custom attribute as a dynamic variable:
- Follow steps 1–2 in the instructions for adding variables to add a dynamic variable.
- Click Subscriber.
- Scroll to the CUSTOM section, then click the custom attribute you want to use as a dynamic variable.
- Add a Default value. Depending on the type of data you collect in your custom attribute, you may not want to include a default value. For example, if you use a custom attribute to store a subscriber’s loyalty program points balance, it might not make sense to include a default value if you don’t want the message to be sent to subscribers who don’t have any points balance data.
- Click Insert.
Note: If you don’t add a default value and custom attribute data isn’t available for a subscriber, a message won’t be sent to that subscriber.
Note: Custom attributes that use the boolean data type can’t be used as dynamic variables and won’t appear in the Insert variable popup. Boolean attributes are either true or false, but they won’t appear as either “yes” or “no” in a text message.
Use custom attributes from apps as variables
Some apps have additional custom subscriber attributes that can be added to messages as variables. For example, you can personalize messages by including subscribers’ favorite colors if that data is available from one of your installed apps.
To add a variable that uses a custom attribute from a third-party app, search for the variable in the Subscriber category in the Insert variable window. You can also scroll the Subscriber category until you find the section for the app that sends the attribute you’re looking for.
Note: Custom attributes as variables are only available with the following apps:
- Klaviyo
- mParticle
- Punchh
- ReCharge
- Segment
- Shopify
- Smile.io
Use Preview Options to preview text messages
Text message previews in campaigns and journeys show you text messages as a recipient would see them. This allows you to validate the appearance and content of your messages, including dynamic content like variables and links. You can also preview how your unsubscribe message appears for AT&T subscribers.
Note: For more information about how character counts and message segments are calculated, see How message character counts are calculated with Campaign Composer.
Follow these steps to preview text messages as a subscriber would see them:
- Go to the text message in a campaign or draft journey you want to preview.
- At the bottom of the preview, click Preview Options. The following options are available:
- Unsubscribe preview: Preview your message with opt-out language for AT&T subscribers. This option only appears if you send messages from a toll-free number.
-
Preview as a subscriber: Preview your message as a subscriber would see it. The preview includes resolved variables, including subscriber names and shortlinks.
For example, if the subscriber's first name is Sam, the preview shows Sam in place of {{subscriber.firstName}}. Similarly, if the name of the message in Attentive is “Spring Sale 2024,” the preview shows “Spring Sale 2024” in place of {{message.messageName}}.
For offer variables and links, the preview shows a placeholder. For example, the preview shows [ OFFER CODE ] in place of {{offer.code}}.
This option is turned on by default. If you turn it off, you’ll see variable names (e.g., {{subscriber.firstName}}) instead of the actual value.
- Use the arrows below the subscriber’s name and number to preview the message as a different subscriber.
If subscriber data is unavailable and the variable doesn't have a default, an informational message appears. - Click Send test message to send a test message using the selected subscriber’s information. You can send a test message to a specific phone number or choose to send a test message to all of the users in your company’s Attentive account.
Notes:
- For campaigns, the subscribers you can preview as are selected randomly.
- For journeys, you can only preview as subscribers who have completed an action that triggers the journey (e.g., they've actually added an item to their cart for cart abandonment journeys).
- For journeys, at least five subscribers must have completed an action that triggers the journey in order to view actual subscriber information in previews.
- Not all subscribers will have values for dynamic variables, so it’s helpful to use a default value where it makes sense.
-
When messages include offer links or variables, the following placeholders
appear:
- [ OFFER CODE ]: appears in place of {{offer.code}}, {{subscriber.signupOffer.code}}
- [ OFFER LINK ]: appears in place of {{offer.link}}, {{subscriber.signupOffer.Link}}
- [ COUPON SCREEN LINK ]: appears in place of {{offer.couponScreenLink}}, {{subscriber.signupOffer.couponScreenLink}}
- The message composer (where you create your text message) on the left side of the screen doesn't show variables or links as a subscriber would see them, nor does it show opt-out text if you use Unsubscribe preview. However, the character counter for the message composer does count opt-out language if you've turned on Unsubscribe preview.
Preview dynamic content in your email
You can preview how your campaign and journey emails will look to your subscribers. Email previews show actual subscriber data in place of variables, such as a subscriber's first name or a product name. You can also send test emails to yourself or others on your team. See Preview and send test emails for more information.