• Naveen VM

Gmail Highlights In Salesforce Marketing Cloud

Updated: Aug 4

What is Gmail Highlights?


As the name itself implies Gmail Highlights provide you a nice overview of all the necessary / important information in your transactional emails.


Why Do you Need to Use Gmail Highlights?


Most of the emails tend to be long and customers might miss some important information. Gmail Highlights will help you to put all the information at one place. This feature helps you to take your brand to provide a unique experience for your gmail users.


Below is the screenshot for Car Rental Reservation Highlights. As you can see, all the necessary information has been added below to the Subject line!


Gmail Car Reservation Highlights from Salesforce Marketing Cloud

Types of Highlights:


Gmail provides a wide variety of Highlights schema which can be used in different industries. You can find all the list of provided highlights here:

  • Bus Reservation

  • Car Reservation

  • Train Reservation

  • Flight Reservation

  • Order

  • Parcel Delivery

  • Hotel Reservation

  • Invoice

  • Restaurant Reservation

  • Ticket Event Reservation

How to Implement Highlights In Salesforce Marketing Cloud?


You can choose any type of highlights schema as per your convenient. In our use case, we will use Car Reservation Highlights markup.


Note: You can also use JSON-LD script in marketing cloud with ampscript. But its even simpler when you use Microdata.


Step 1: Prepare the Markup for Car Reservation Highlights


You can find the Gmail markup documentation for highlights here.


Below is the sample mark up which we will use for our use case (view code snippet):

Step 2: Test Your Markup


Gmail has provided a tool named 'Markup Tester' to test your markup. You can access it here.

This tool will provide an error, if there are any mandatory missing properties. It also gives warning message if any of the non-mandatory properties are missing.

It is important to test your markup to know whether you are in the right direction or not.


Note: Since, you tested your schema is correct. You can't just add the above code and test directly in Salesforce Marketing Cloud. Gmail support team needs to whitelist your From address.


Step 3: Send a Test Email


Please follow the Gmail documentation for testing to your email if the below is not clear.


  • Visit script.google.com and click on new project in the top left corner

  • Replace the code in Code.gs with the following:

/**
 * Tests the schema.
 */
function testSchemas() {
  var htmlBody = HtmlService.createHtmlOutputFromFile('mail_template').getContent();

  MailApp.sendEmail({
    to: Session.getActiveUser().getEmail(),
    subject: 'Test Email markup - ' + new Date(),
    htmlBody: htmlBody,
  });
}
  • Select File > New > Html file to create a new HTML file. Name the file mail_template to match the parameter in the JavaScript above. Replace the content of the HTML file with the above car rental reservation.

  • Save the project and click on run.

  • The first time you run the script you'll be asked to grant authorization, select advance and provide permission.

  • After the script runs, check your inbox for an email sent from yourself with Gmail highlights.

Step 4 : Register with Google


Add the static car reservation highlights markup in any of your Salesforce Marketing Cloud emails and send it to schema.whitelisting+sample@gmail.com.

When you register with Google, make sure you follow the guidelines.


Few considerations in terms of Salesforce Marketing Cloud:

  • Make sure your SPF, DKIM is not failing. If you have a SAP and delegated to marketing cloud then 99% this issue won't happen.

  • If you are using dynamic sender profiles and need to use highlights for all the emails then send the same email with each sender profiles.

  • Fill out the form to whitelist your sender profiles.

  • Google support will contact you in case of any missing informations.

  • Once it has been approved then generally it will take 3 weeks to whitelist your send profiles.

Step 5: Make the Mark up Dynamic with Ampscript:


You can check after 3 weeks and send a test email with Gmail markup to any of your gmail accounts. If the highlights are coming, then just replace the static mark up with dynamic fields using ampscript (View Code Snippet).


Few considerations in terms of Salesforce Marketing Cloud & Gmail:

  • Gmail will only accept this"2020-06-30T20:00:00-07:00" date time format. So manipulate the time format with an ampscript like the above code. Else the highlight markup will not show up in Gmail.

  • Some of the attributes like modify reservation URL are not mandatory. So if you leave it as blank it will still accept it.

  • This highlight will work both in Mobile & Web but only in Gmail.

  • The highlight will show only if you send an email from the whitelisted sender profiles.

Hope this gives an idea on how to use Gmail Highlights in Salesforce Marketing Cloud.


Please feel free to leave your thoughts on comments section.


Happy Learning!


#GmailHighlights #SalesforceMarketingCloud

272 views