Gmail Inbox Actions in Salesforce Marketing Cloud

What is an Action in Gmail?

Actions in Gmail refers to making the user to interact with your product or service either inside or outside Gmail. Well we know that emails are generally used to interact with customers. What's the big thing?


Well, you don't have to click on the email and go into the email body to interact with them. You can just interact with email senders in the subject itself. How cool is that!

How is it working and what is Schema.Org?


Schema.org is a markup vocabulary that is standardized and managed as a collaboration of Google and other companies.

HTML tags tells the browser how to display the information included in the tag. For example, <p>Avengers</p> tells the tells the browser to display the text string “Avengers” in a paragraph format. However, HTML doesn't tell its a huge successful movie. Here is where Schema.org comes into picture. It provides a ‘collection of shared vocabularies can use to mark up their pages in ways that can be understood by the major search engines: Google, Microsoft, Yandex and Yahoo!’


Schemas in Gmail support both JSON-LD and Microdata, this lets Google understand the fields and provide the user with relevant search results, actions, and cards.


In terms of Salesforce Marketing Cloud JSON-LD is not supported. It only supports Microdata. JSON-LD needs to be on the header with script tag. But Microdata is just can be denoted like a HTML.


Types of Actions:


  • In-App/One click Action

  • Go-to Action

In-App / One click Actions:


In All actions are generally one click actions where you don't have to go out of Gmail. All the interactions are handled inside Gmail.

In App action further varies to :

Save action is like saving the product and look into later in Gmail or it can be adding a song.

Confirm action is like confirmation of user registration, double-opt-in email confirmations which can be done only one. Once the user clicks on the button, an HTTP request will be issued from Google to your service, recording the confirmation. Also Check out for how to handle the request.


Go-to Actions:


Go-to actions are something which can take you outside of Gmail without opening the body of the email. You can use this view an offer, track your package etc.


Demo:


Below is the microdata can be taken it for an example. Use case is like customer has filled up the lead form and need to send a real time welcome email and asking the customer to subscribe.


Use this tester tool to test your schema.

<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="potentialAction" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://www.salesforcefan.com/"/>
    <meta itemprop="name" content="Subscribe"/>
  </div>
  <meta itemprop="description" content="Subscribe to Salesforce Fan"/>
</div>

  • Go to App script tutorial page and follow 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 following:

<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="potentialAction" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://www.salesforcefan.com/"/>
    <meta itemprop="name" content="Subscribe"/>
  </div>
  <meta itemprop="description" content="Subscribe to Salesforce Fan"/>
</div>
<p>
      This a test for a Go-To action in Gmail.
    </p>
</body>
</html>
  • 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 a Go-to Action button, as in the following screenshot:


Test is done what's next?

Once your mark up is tested and finalised fill out the registration form review to google .

Wait for Gmail’s response that your sending address has been “whitelabeled” and set live!


Once Google has whitelisted, you can just add the HTML schema in your Salesforce Marketing Cloud email and send it.


Google might approve only transactional mail not to bulk emails.


Is this actions only applicable to Gmail?

Yes, these actions are only applicable to gmail but you can send it to other email clients, they won't mark it as spam.


Hope this will give you an idea on how to use Gmail actions in Salesforce Marketing Cloud. Please let me know your thoughts on the comment.


Happy Learning!

#Salesforcefan #sfmc #gmail

116 views0 comments

Recent Posts

See All