SendGrid Implementation Guide

SendGrid is a cloud-based SMTP provider. Salesforce Audience Studio can collect data from SendGrid campaigns by having the Audience Studio trackers included in the email bodies. This guide will walk you through the basics of how to do this in SendGrid. For more information, you should consult the SendGrid documentation.

User Matching

User matching lets Audience Studio understand how another platform, such as SendGrid, identifies a person/browser. It's done by having the partner send Audience Studio subscriber information through user matching pixels in your email campaigns. Unfortunately, while SendGrid does assign a recipient ID to subscribers, it doesn't have a way to populate this information in the user match pixel when you're using the SendGrid web interface. If you are using the SendGrid SMTP API, please speak to your Salesforce Audience Studio Solutions Team about how to include user match pixels.

Custom Fields

When it comes to dynamically inserting values into the pixels or click trackers, SendGrid offers two options: Custom Fields and Substitution/Section Tags. Custom Fields are a method in SendGrid for you to personalize email campaigns by creating a custom field, and then populating your user lists with that information. There are a default set of fields/tags available, including things like [%first_name%], [%last_name%] and [Sender_Name]. When you see a percent sign (%) in the tag, it means that the item is a Custom Field – and otherwise they are Substitution Tags. You can see the full list of what is available when you are in the SendGrid Email Editor by clicking on Tags in the left-hand navigation menu.

Fig 1. Available Tags in the SendGrid Email Editor

It is possible to create your own Custom Fields, but you should know that the data for these fields is about the users, not the email campaign itself. So if you had gathered information about the types of pets your subscribers had, and called it Pets when you created the Custom Field, you could have that information dynamically pasted in to an Event Pixel as an attribute using the string [%Pets%]. If you had a Salesforce Audience Studio Event pixel with an attribute called CurrentPet (and the event_id was xxxxxx), then the tag for the Event Pixel in SendGrid would look like:

<img src='http://beacon.krxd.net/1x1_event.gif?event_id=xxxxxx&event_type=email_open&CurrentPet=[%Pets%]' width=0 height=0 style='display:none;' />

For more information on Custom Fields, read SendGrid's documentation.

Substitution and Section Tags

It’s also possible to use Substitution and Section Tags to dynamically populate information in the Audience Studio Trackers. The difference between a Substitution Tag and a Section Tag is that a Substitution Tag tends to be about the person you are sending the email to, and a Section Tag tends to be about the email itself. However, the Substitution and Section Tags are only supported when you are using SendGrid’s SMTP API to send out emails with SendGrid, not their web interface. If you are using their API, SendGrid offers some examples on how to use Substitution Tags in their documentation. The documentation for the Section Tags is here.

SendGrid Web Interface

To collect the data from your email campaigns, you need to either include Audience Studio Campaign Trackers or Audience Studio Event Trackers. The Email Campaign Implementation Guide outlines which trackers you should use, depending on how you would like to use the data in the Audience Studio platform. For the purposes of this guide, we will assume that you have the trackers that you need to add to your email campaigns.

Your trackers may have placeholder strings in them, like REPLACE_WITH_ADVERTISER_ID. If so, you need to replace those strings with the values you want to collect intoAudience Studio. The Audience Studio Impression Trackers have a series of standard fields that you would normally see associated with a media campaign, such as Advertiser ID, Campaign ID, or Placement ID. You need to map these fields to the email campaign data that you would like to collect. You can either hard-code values in, or use Custom Fields to have SendGrid dynamically populate the values when an email is sent. In either case, you need to make sure that the values inserted into the Audience Studio Trackers only include characters that are accepted for those fields.

To add the Audience Studio Trackers to an email in SendGrid, you need to add the appropriate pixels as image tags in the HTML body of the email. To do this through SendGrid’s web interface, login to SendGrid and click on Marketing in the left-hand navigation. Then click on Campaigns to bring up the Marketing Campaigns page.

Fig 2. The Marketing screen in SendGrid

Click on the name of the campaign you wish to work with, or click on the “Create Campaign” button to create a new one. This will take you into the Email Editor, with the drag and drop editor enabled for the email template. It’s usually easier to add the needed image tags directly to the HTML, so our suggestion would be to switch over to the HTML code version of the editor by clicking on the "<> CODE" menu item at the top of the page.

Fig 3. SendGrid's Email Editor

With the HTML code displayed, scroll to the body of the email and paste in the image tags for the Audience Studio pixels. You do not need to place the Audience Studio tags in a particular location, but we do recommend placing it as close to the top of the email as possible. The pixels, however, should be added to the <body></body> section, because the <head></head> section can be stripped by some email clients.

Fig 4. Viewing the code in the Email Editor

With the Click Trackers, you can either find the appropriate <a href tags in the code, and paste the Click Trackers in, or switch back to the drag and drop editor by clicking on “DESIGN” in the menu at the top of the page. If you use the drag and drop editor, to add the Click Trackers to links for images, you need to edit the Image Properties, and paste the Click Tracker and Click-through URL into the Link URL field. If it’s a text link, you add the Click Tracker by highlighting the text that should be linked, and clicking on the Link button in the top right-hand side of the subnavigation menu. This will bring up the Link Preferences overlay, and you can paste the Click Tracker and Click-through URL into the URL field.

Fig 5. After adding the Salesforce Audience Studio tags to the code

Once you have added the Audience Studio Trackers to the email, click "Save Draft" in the Email Editor menu, and you're all set. When you send the email campaign, Audience Studio will be able to gather data from the emails when they're opened by your consumers. 

Have more questions? Submit a request

0 Comments

Article is closed for comments.