
## Common tags available in email communication

You can use all tags from [Insert usage](/developers/inserts/insert-usage).


<div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

If you use Visual Studio Code as your editor, you can use code snippets to speed up working with inserts.  
You can find the snippets in our Github repository: [https://github.com/Synerise/jinja-code-snippet](https://github.com/Synerise/jinja-code-snippet)

</div></div></div>


## Opening a message in the browser

You can generate a URL that opens the message in a browser.


<pre><code class="language-jinja">{{ synerise-open-in-browser }}</code></pre>


The URL is generated as plain text. If you want it to display as a hyperlink, add HTML, for example:

<pre><code class="language-html">&lt;a href="{{ synerise-open-in-browser }}"&gt;Click to open the message in a browser&lt;/a&gt;</code></pre>


## Adding a resignation link

You can generate a URL that revokes the customer's email communication agreement.


<pre><code class="language-jinja">{{ synerise-resign-link }}</code></pre>


The URL is generated as plain text. If you want it to display as a hyperlink, add HTML, for example:

<pre><code class="language-html">&lt;a href="{{ synerise-resign-link }}"&gt;Unsubscribe&lt;/a&gt;</code></pre>


## Adding UTM and tracking parameters to links

If the message includes links, you automatically add parameters (such as UTM) and track click events by using `{% preparelink %}{% endpreparelink %}`. This will generate a redirect URL based on the hosting environment of your workspace:    

If your workspace is hosted on: 
- Microsoft Azure EU, the default domain redirect URL is `link.snrs.it`,
- Microsoft Azure USA, the default domain redirect URL is `link.azu.snrs.it`
- Google Cloud, the default domain redirect URL is `link.geb.snrs.it`.


  <div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

  On the user interface in the Synerise platform, you can configure how the end user's identifier (UUID) is handled [when a link contains end-user identifying parameters](/developers/web/user-identification#recognizing-customers-from-link-parameters) (`snrs_cl` and `snrs_he`); for detailed instructions, see the ["Managing user context" section](/docs/settings/configuration/non-unique-emails#managing-user-context).

  </div></div></div>
  

### Configuring a custom domain for redirect URL

If you have already set up a custom domain (for example, for [first-party tracking](/developers/web/first-party-tracking)), you can use it immediately without any additional configuration; simply contact [Synerise Support](https://hgintelligence.atlassian.net/servicedesk/customer/portals) for assistance. Otherwise, to set up a custom domain for the redirect URL, meet the following requirements:

- If you want to provide your own certificate:1. Prepare an X.509-format certificate.
                                              2. Deliver the following files to Synerise Support:  
                                              - private key (`key.pem`)
                                              - Fullchain certificate (`fullchain.pem`):  
                                                  - The leaf certificate **must be the first** in the file.
                                                  - Intermediate certificates must follow, from the lowest-level to the highest.
                                                  - **Do not** include the root CA.
                                              
   <div class="admonition admonition-important"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

   - When you use your own certificate, it is your responsibility to monitor its expiration time and re-generate it.
                                                 - Ensure that the `fullchain.pem` file is complete. Missing certificates or wrong certificate order may cause SSL/TLS errors.

   </div></div></div>

- Send the SSL certificate to Synerise Support or give an approval for generating a certificate through Let's Encrypt.
- Configure DNS - add the `CNAME` record. Depending on the cloud where your workspace is hosted:
    - for Microsoft Azure EU, set the CNAME to: `link.snrs.it`
    - for Microsoft Azure USA, set the CNAME to: `link.azu.snrs.it`
    - for Google Cloud Platform, set the CNAME to: `link.geb.snrs.it`
- Submit a customer service request for configuring your domain in Synerise.
 

#### Preview in messages

If you use a custom redirect URL, the links in the message preview still use the default domain. The custom domain is applied while sending the messages to customers.

### Usage

- Emails: 
    - If your link is stored as a Jinja variable and then used as a variable in the HTML, you must use a `preparelink` tag to generate a link with the parameters:  
    
      <pre><code class="language-jinja">{% set a = "/" %}
      &lt;a href="{% preparelink %}{{a}}{% endpreparelink %}"&gt;Link text&lt;/a&gt;</code></pre>

    - If the link is defined in the template as plain HTML, the parameters and tracking are added automatically when parsing the HTML. You don't need to use the insert:
    
      <pre><code class="language-html">&lt;a href=""&gt;Link text&lt;/a&gt;</code></pre>

- Mobile push and SMS:
    - 
      <pre><code class="language-jinja">{% preparelink %}YOUR_URL{% endpreparelink %}</code></pre>


Example of a parsed link:
```
/?snrs_medium=email&snrs_action=newsletter.click&snrs_test=false&snrs_var=4715029&snrs_cp=6b716f86-a14d-4b8c-8795-872f7432a046&snrs_cl=b5d8c721-c2b7-42ac-9cd5-7714dedf73bf&snrs_category=client._DEVICE_.browser.mail&snrs_he=1940871749&snrs_redir=1
```


## Validation
Whenever you use Jinjava in email communication, verify that it displays correctly for a few different test customers to make sure that the logic you applied covers all scenarios. If Jinjava fails to render, the communication is not sent to a customer at all.

If the sending failed, a `message.notSent` event is saved to the customer's profile, with additional information in the `extra` property. This works both for test emails and already launched communications.


<div class="admonition admonition-warning"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z" /></svg></div><div class="admonition-body"><div class="admonition-content">

If a tag is not opened/closed properly it is treated as plain text and does not cause an error.  
**Example:** Missing `}` in `{{ synerise-resign-link }`

</div></div></div>


In the following example, a typo (missing `w` letter) when calling `synerise-open-in-browser` tag caused a wrong interpretation of the tag and a rendering failure.


<div class="highlight-code-block" data-hl-lines="13">
<pre><code class="language-json">{
    "action": "message.notSent",
    "eventUUID": "e0096c9d-8abc-4c4e-b75f-efa3c56934b0",
    "createDate": 1620912890658,
    "label": "dfbbb5f6-abf6-4c79-87db-f893359ffa5d",
    "params": {
        "clientId": 1382495929,
        "auth.internal": false,
        "info": "rendering failed",
        "testDelivery": true,
        "id": "dfbbb5f6-abf6-4c79-87db-f893359ffa5d",
        "campaignName": "Test",
        "extra": "Missing synerise-open-in-broser value",
        "time": 1620912890658,
        "title": "Test"
    }
}</code></pre>
</div>


