How to insert individual user data into your own HTML newsletter
In Convead, you can create mailings based on templates (using a visual designer) or from scratch using HTML.
In the visual mailing designer, individual data is inserted using the icon {…} from the pop-up menu.
To insert visitor fields into an HTML mailing, you need to write instructions in Liquid – the language of templates.
A visitor object is available in the HTML template with the following labels:
- id – identifier (number)
- first_name – first name
- last_name – last name
- email – email address
- phone – phone number (string)
- gender – gender
- country_name – name of the country
- city_name – name of the city
- visits_count – number of visits (number)
- date_of_birth – date of birth (string: format YYYY-MM-DD)
- custom_properties – object with additional individual fields
- revenue – total amount of orders (number)
When you insert these values into an email, you can customize them individually using CSS styles supported by email clients. Please note that when creating HTML mailings you will need to be careful to adhere to a number of recommendations, because email clients are quite capricious and do not understand some of the most recent layout standards.
A simple example of how you can insert individual fields into a newsletter:
<code><code>Hello, {{ visitor.first_name }}
Additional fields can be inserted as follows:
<code><code>Your promo code: {{ visitor.custom_properties.code }}
Important point! In preview mode, when you edit an HTML email and when you send a test email, Convead will display stubs instead of individual fields. For example, “first_name” will be written instead of the name. It will apply to them the styles you specify. This is done so that you can easily imagine what the data fields will look like in the actual email. When you send a real mailing to the client, the real data will be inserted into the email. If the specified field is not filled in, it will be skipped.
Individual fields can not only be inserted into the mailing, but also used in different conditions. For example, if you know the recipient’s name, you can insert it into the email, but if you don’t know their name, you can specify that you want to write “Dear colleague” or a similar salutation. To do this, you can use this code:
<code><code>Hello, {% if visitor.first_name == null %}Dear colleague!{% else %}{{ visitor.first_name }}{% endif %}!
Another important point! Before sending a mailing, be sure to check how it will look in the preview and send yourself a test email (buttons at the upper right) to make sure that all the items are displayed correctly.