Creating a new Email Digest Template
Email templates in Metric Insights are created using HTML, CSS, and JavaScript, allowing great control over how the email body of your company's digests will look.
If your business requires a custom template, you can create one following the instructions below, or contact [email protected] to submit a request for a template with specific requirements.
1. Open the list of Email Templates
- Go to Admin > Email Templates
- The list of email templates available in the system opens. Your Metric Insights instance comes preloaded with 16 default templates shown at the screen above. Each of such templates is marked either as locked or default and can be neither edited, nor deleted
2. Creating a new template
[Option 1] Duplicate on of the default templates
- Open the Digest Template that should serve as a basis of a new editable template
- Click the Duplicate icon at the top right corner of the screen
- Provide a name for a new template in the opened pop-up
- Click Duplicate
You can edit this template according to your requirements. For more details on Email Template properties and settings, refer to Step 3.
[Option 2] Create a new Template based on an existing one
- Open the list of Email Templates
- A the page bottom click [+ New Template]
3. Defining Digest Template settings in the Editor
Information tab
Information tab allows you to set Default templates and to specify datasets for inclusion in Preview and Test emails.
The Attached Datasets section allows you to add a set of data from MI elements to be available in the email digest. In order to specify a dataset:
- Click [+ New Dataset]
- Select a dataset you want to use
- Save the changes made
You can use this option to specify MI elements you want to see in your digest for the specified template. E.g. When you specify Report 1 in Dataset for a particular Digest Template and set users to receive the template emails, they will receive the Report 1 dataset in emails.
NOTE: It's not obligatory to add datasets for creating digest templates.
Email Structure
The Change history button allows you to view revisions to your code over time.
The screenshot above displays the default Favorites template. You can use this as a base example of the code from which to build your own template.
NOTE: If you duplicated one of the default templates, this tab is going to contain the HTML code that is used to define the structure of the email body. If you create a template from scratch, it is going to be empty.
Transformation & Rendering
This tab contains the rendering template for each section identified in the sections tab. This code specifies how the data will be rendered.
NOTE: If you duplicated one of the default templates, this tab is going to contain the HTML code that is used to define the structure of the email body. If you create a template from scratch, it is going to be empty.
How to remove hyperlinks from email templates?
To remove the href entirely:
$('#elementsTd').find('a').each(function(){
$(this)
.removeAttr('target')
.removeAttr('href')
Section Templates
From this tab, you can manipulate the input data, such as appending report data (datasets) to the core digest data object (digestTemplate.data), applying transformation functions, and initiating the rendering of email sections as defined in the sections code.
NOTE: If you duplicated one of the default templates, this tab is going to contain the HTML code that is used to define the structure of the email body. If you create a template from scratch, it is going to be empty.
Settings
The variables in the Settings tab allow you to customize as well as turn on/off features for your Digest and Burst Emails. Some examples are:
- SHOW_UNSUBSCRIBE_LINK will determine whether or not an unsubscribe link will be included in the emails
- HEADER_IMAGE can be changed to a file uploaded via the Branding page
- MAX_DIGEST_ANNOTATION_DISPLAY will set the maximum number of annotations displayed within the Digest
Applying custom email digest templates
Favorites Digest
In order to use your newly created custom Email Digest Template in Favorites Digest you need to:
- From the User menu, select "Favorites"
- Choose your custom Email Digest Template from the Email template drop down list
To learn more about Favorites Digests, visit: What are Favorites Digests?
Bursts
Templates are applied to your Bursts in the same manner as favorites.
- From the User menu, select "Bursting"
- Choose your custom Email Digest Template from the Email template drop down list
To learn more about Bursts, visit: Setting up a new report burst