Using Event Trackers to Capture Email Opens and Clicks

In order for Salesforce DMP to collect data from emails, a tracker needs to be included in the email body. Salesforce DMP has two types of trackers that you can use for this: Event trackers or Campaign trackers.   The difference between the two has to do with what you are using the emails for, and how the data is reported on within the Salesforce DMP. If the emails that you are sending would be considered part of an email marketing campaign, then you should use the Campaign Impression and Click Tracker option, because then the data will be treated like campaign data. If the emails are more transactional – like say a welcome email for when a new user registers an account – then you should use Event Pixels with Event Click Trackers, if need be. If the latter applies to you continue reading below, it the former please click here: to learn about applying media impression and click trackers to your email campaigns.

Event Trackers

Events are configurable through the platform’s web interface, and can be used to understand the users who open your emails or click on the links within them. Events can then be used in the platform to create funnel reports, or to define audience segments. Data from Events do not show up in the Marketer Campaign Performance reports. If you need the data in those reports, you should use Campaign Trackers instead.

Creating an Event Pixel for Emails

You access events by selecting Events from under the Manage menu in the console. This will bring you to a page that will list out all of the current events, as well as allow you to create a new event.

To create a new event, click on the “+ Create Event” button at the top of the page. You will then be presented with the new event form.

Enter a name for the event, and then for the Event Type, select “Email Open”.

You can choose to leave the Event Category field blank if you’d like, or to enter a category. This field is used to organize the events in the platform. You can also choose to pass in one or more event attributes by adding an entry for each attribute in the table at the bottom of the form. For each attribute, enter the Attribute Name as it will be listed in the event pixel code, as well as the Attribute Display Name for how it will be seen in the platform. Because the Attribute Name is used in the pixel code, you can’t include spaces in the name. The only accepted characters are alphanumeric (Aa-Zz,0-9), as well as dashes (-) and underscores (_). To add additional attributes, click on the “Add Another” button to have another row added to the event attribute table.

Once you have filled in the form, click on the “Save and Get Code” button. This will bring up the Get Event Code form, with the “JavaScript snippet” version of the Code Format.

With emails, it is important to switch this over to the “Pixel for an external site” option for the Code Format for two reasons. The first is that JavaScript isn’t usually supported in emails, so the JavaScript snippet won’t work. The second reason is that the JavaScript snippet works in conjunction with the Control Tag that you include on your web pages. So even if JavaScript was supported in email, you would also have to include a Control Tag for it to function properly.

For the URL type, you can select either HTTP or HTTPS. Typically, HTTP is fine for emails, but if all of the other images in your email use HTTPS, you can use that protocol for the event pixel as well. You might think that the best thing to do would be to use the relative protocol of "//" - which, in browsers, allows the browser to select the appropriate protocol. We caution against that because email clients don't universally support the relative protocol. Some email clients interpret "//" to mean "file://" instead, which might cause display issues.

If you chose to include attributes for the event, you will also see fields listed for each attribute you listed. You can hard-code values in to the event pixel URL by entering the values into the appropriate field. When you enter a value in this form, the text string you enter will be url-encoded in order to have the URL function properly. If you choose to edit the pixel code directly, please make sure that any values you manually enter into the URL are also url-encoded. You can find out more about URL encoding here: http://www.w3schools.com/tags/ref_urlencode.asp

If the email system you are using to send the emails supports it, you can also have that system dynamically insert values into the pixel as well using macros or substitution strings. To do so, you can either enter the substitution string your email system uses into the appropriate fields in this form, or you can enter temporary placehold text like "PLEASE_REPLACE". If you leave any of the values blank, then the code that is generated won’t include a field for that attribute.

If you use placeholder text, please remember to replace that text with the appropriate macros or substitution strings when you add the event pixel to your emails.

The simplest form of an event pixel for gathering data from emails looks like:

<img src='http://beacon.krxd.net/event.gif?event_id=xxxxxx&event_type=email_open' width=0 height=0 style='display:none&' />

The xxxxxx string in the above tag would normally be a unique alphanumeric string that is the Event ID the particular event. The Event Pixel is solely defined by this Event ID, and not the unique URL with the rest of the attributes or parameters that you might send in with it. What that means is that you can use the same Event Pixel for different emails – such as with a welcome email and a reset password email – but you won’t be able to differentiate how the different emails contributed to the Traffic, Audience Profile, or Funnel reports. If you want to be able to differentiate how different types of emails contribute, then you will need to create individual Events for each type.

In our screenshots, we’ve shown two example attributes for the event: Send Date and Account Type. If we entered PLEASE_REPLACE for those two fields, the resulting code would look like:

<img src='http://beacon.krxd.net/event.gif?event_id=xxxxxx&event_type=email_open&AcctType=PLEASE_REPLACE &SendDate=PLEASE_REPLACE' width=0 height=0 style=’display:none&’ />

The PLEASE_REPLACE strings would need to be replaced with the appropriate substitution strings for your email system. For example, Email Studio in the Salesforce Marketing Cloud supports dynamic content in emails through AMPscript and personalization strings. Some of the available personalization strings include %%xtmonthnumeric%%, %%xtday%%, and %%xtyear%% for the month, day, and year, respectively, of the send date. So for the SendDate field above, the PLEASE_REPLACE string could be replaced with those personalization strings to look like:

<img src='http://beacon.krxd.net/event.gif?event_id=xxxxxx&event_type=email_open&EmailType=PLEASE_REPLACE &SendDate=%%xtmonthnumeric%%%%xtday%%%%xtyear%%' width=0 height=0 style='display:none;' />

When Email Studio sends the email, the personalization strings would be replaced by the Salesforce Marketing Cloud platform with the correct values. If the send date was January 15th, 2017 – and say the Account Type was hard-coded to say Personal, then when the email was delivered to a user, the pixel would look like:

<img src='http://beacon.krxd.net/event.gif?event_id=xxxxxx&event_type=email_open&AcctType=Personal&SendDate=01152017' width=0 height=0 style='display:none;' />

Once you have generated the event pixel, you deploy it by including it in the body of the HTML version of your emails. When the pixel is included in the body of an email, and a user opens the email and loads the images, a request will then be made to the Salesforce DMP servers allowing this data to be collected.

The code generated from the platform uses a location that starts with "http://beacon.krxd.net/event.gif". Since Salesforce DMP uses these types of pixels purely to collect data, they are configred to respond with a "204 No Content" response code. What this means is that the Salesforce DMP servers correctly received the information, but is not sending back any actual content. Web browsers know how to properly handle a 204 response code, but there are a few email clients that don't. Instead, they might display a broken image. Because of this, Salesforce DMP also offers an alternative pixel that actually returns a "200 OK" response code with a 1x1 pixel sized image. To use this pixel, all you need to do is add the string "1x1_" right before the event.gif in the URL - so it looks like "http://beacon.krxd.net/1x1_event.gif" instead.

Creating an Event for Tracking Clicks

If you would like to gather data when a user clicks on a link in the email, you can do that using an Event Click Tracker. To create the tracker, go back to the Events screen by clicking on Events under the Manage menu. To create a new Event Click Tracker, click on the “+ Create Event” button. Fill out the new event form as you normally would, but this time select Salesforce DMP Click Tracker for the Event Type.

As with an event pixel, you can choose to add in additional attributes to be passed in to the click tracker as well. Once you have filled out the needed information in the New Event Form, click on the “Save and Get Code” button.

With a click tracker, you must enter a Click URL. This is the click-through URL of the landing page where you want people to go to when they click on the link. Please note that you need to include the HTTP:// or HTTPS:// portion of the URL as well in the Click URL field.

If you included event attributes for the click tracker, there will be fields listed for each attribute as well. You can either hard-code values in by entering the values here, create placeholders by entering a temporary text string in these fields, or enter the appropriate macro or substitution string for your email system if it supports this type of functionality. If you don’t enter a value in for a field, it won’t be included in the generated click tracker code.

The most basic format of an Event Click Tracker is:

http://apiservices.krxd.net/click_tracker/track?kx_event_uid=xxxxxx&clk=http%3A%2F%2Fwww.example.com

The xxxxxx string in the above would normally be a unique alphanumeric string that identifies the particular event, and the "http%3A%2F%2Fwww.example.com" is an example click-through URL (which has been url-encoded). If you included an attribute with the field name LinkName – and a url-encoded value of “New Account” – then the click tracker would look like:

http://apiservices.krxd.net/click_tracker/track?kx_event_uid=xxxxxx &kx_LinkName=New%20Account&clk=http%3A%2F%2Fwww.example.com

It’s important that a click-through URL is always provided, and that the click-through URL always comes at the end of a click tracker, right after the clk= field header.

Once you have the code for the click tracker, you deploy it by including it in the appropriate links in the HTML body of your email. For example, if you had a link in your email that looked like:

<a href=”http://www.example.com”>See our new site</a>

With an Event Click Tracker, this link would now look like:

<a href=”http://apiservices.krxd.net/click_tracker/track?kx_event_uid=xxxxxx&clk=http%3A%2F%2Fwww.example.com”>See our new site</a>

You do not need to create a unique Event Click Tracker for each link. You can use the same Event Click Tracker for different links, and if you need to distinguish between clicks on different links, use event attributes to do so.

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk