First steps
User Data
- Responsive Email Editor Review
- Designing your email
- Creating Synchronized Modules
- Setting Up Responsive Email Design
- Setting Up Smart Containers
- Creating a Gmail Promotions Annotation
- Adding The Rollover Effect
- Adding Anchor Links
- Module Library
- Adding a Table to an Email
- Adding Custom Fonts
- Creating CTA Button
- Working with Images
- Creating Timer
- Using AI in the Email Editor
- Messenger Protocol Support in Email Clients and Platforms
Omnichannel
- Setting Up Widgets for Your Site
- Widgets Gamification
- Widget Calling
- Setting Up Locations for the Widget Calling Rules
- Storing data from widgets to contact fields
- Using Annoyance Safeguard
- Actions After Form Submission
- Replacing Double Opt-In System Workflow
- Creating Pop-ups via Google Tag Manager or WordPress
- Sending Yespo Widget Events to Google Analytics
- Using A/B Tests for Widgets
- Collecting Contact Information Using Request Forms
Automation
- Building and Editing Workflows
- Configuring Workflow Start/Stop Conditions
- Start Block
- Popular Blocks
- Message Blocks
- Using One from Many Message Block
- Contact Blocks
- Conditions Blocks
- Other Blocks
- Message to Segment Blocks
- Time Blocks
- Advanced Workflow Block Parameters
- Setting Up Allowed Send Time
- Using Workflow Launch History
- Webhook Workflows
- Workflow Troubleshooting
- Double Opt-In
- Welcome Сampaign
- Welcome Series Segmented by Category
- Launching a Workflow After a Contact Import
- Regular Workflow for a Segment
- Birthday Campaign
- Linking Workflow to the Button
- Using Variables from Order in Workflow
- Collecting Order Feedback
- Customer Reactivation
- Sending Extra Campaigns
- Sending Reminders at the Time Specified by the User
- Sending Campaign to Those Who Did Not Open the Previous One
- Using A/B Tests In Workflows
Personalization
Analytics
- Email Campaign Report
- Web Push Campaign Report
- Viber Campaign Report
- Mobile Push Campaign Report
- App Inbox Campaign Report
- Telegram Campaign Report
- In-App Report
- Widget Report
- Triggered Campaign Report
- AMP Campaign Report
- SMS Campaign Report
- Multilingual Campaign Report
- Setting up UTM Tags
- Revenue from Campaigns
- Tracking Campaign Performance in Google Analytics 4
- Message Analytics
Multilanguage Campaigns
Events and Behaviour Tracking
Recommendations
API
Security and Compliance
Substituting Email Blocks According to Contact Profile Data
The Velocity code allows you to create an email with content depending on the data in the contact's profile, e.g., gender. Men will see a selection of products for men, women — for women, and those contacts whose gender is not specified — a common product selection.
Setting Up Dynamic Blocks
1. Place three structures with content for different segments in the template: women's clothing, men's clothing, and a common product selection.
2. Select the structure with women's products and open its code editor.
3. Declare a variable from the contact profile above the first tr tag. In our case, this is an additional contact field %PERSONAL.GENDER%.
Important
The variable's name in the template must match the name of the additional contact field, which you can see in the account settings on the Additional fields tab. Read more about contact fields in the manual.
4. Add a conditional statement to the code. Use the following format:
<!--#if($data.get('parameter name')=='value1')-->
In our case, the operator will be like this:
<!--#if($data.get('PERSONAL.GENDER')=='F')-->
5. Select the structure with men's products. You will see the structure’s code in the editor.
6. Add a conditional statement to the code above the tr tag. Use the following format:
<!--##elseif($data.get('parameter name')=='value2')-->
In our case, the operator will be like this:
<!--#elseif($data.get('PERSONAL.GENDER')=='M')-->
7. Select the structure with the common products.
8. Add a conditional statement to the code above the tr tag. Use the following format:
<!--#else-->
9. Add a <!--#end--> statement after the /tr tag that closes the structure.
You can make a more complex check in case the fields have different cases: "M" or "m", "F" and "f":
#if($data.get('PERSONAL.GENDER')=='m') and $data.get('PERSONAL.GENDER')=='M')
You can also use such option:
#if($data.get('PERSONAL.GENDER').equalsIgnoreCase('m'))
Similar articles: