Email Campaign Implementation Guide

In order for Salesforce Audience Studio to collect data from emails, a tracker needs to be included in the email body. Audience Studio 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 Audience Studio Platform. 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 former applies to you continue reading below, it the latter please click here: to learn about using event pixels to capture email opens and clicks.

Campaign Trackers

Events are the best way to track transactional emails, but if you send out email marketing campaigns, then you should use the Audience Studio Campaign Trackers. If you track emails using an Audience Studio Impression Tracker, you will be able to see the data in the Campaign Performance reports in the platform. If you want to be able to do things like compare how your email marketing impacts your paid search marketing, or vice versa, you need to use an Impression Pixel with a unique Audience Studio Configuration ID for the email marketing. (You can, by the way, include both Event Pixels and Impression and Click Trackers in a single email in order to benefit from both.)

By using the Impression Pixel, when a person opens their email, it will register as an impression in the Campaign Performance reports. With the Click Tracker, when they click on a link in the email, it will count as a click in the Campaign Performance reports as well. The Impression Pixel can be included anywhere in the body content of an email, but it can only be used with the HTML version of the email content. The text version of the email would not only show the code, but also never make the request for the image.

Impression Pixels for Emails

The format for the Audience Studio Impression Pixel is shown below. The values for the Advertiser ID, Campaign ID, Placement ID, Site ID, Ad ID, and Creative ID are all values that you choose. If you would like to treat all email campaigns as one over-arching campaign, you could hard-code a value in for the Campaign ID and use that value in the Impression Pixel for all of your emails. If you’d like to be able to differentiate between different campaigns, then you would need to provide different campaign IDs. 

<img src='[REPLACE_WITH_ADVERTISER_ID]&campaignid=[REPLACE_WITH_CAMPAIGN_ID]&placementid=[REPLACE_WITH_PLACEMENT_ID]&siteid=[REPLACE_WITH_SITE_ID]&adid=[REPLACE_WITH_AD_ID]&creativeid=[REPLACE_WITH_CREATIVE_ID]' width=0 height=0 style='display:none;' />

While the example above uses the HTTP protocol, HTTPS is also a supported protocol for all Audience Studio URLs. The example also uses the location "". The inclusion of the "1x1_" string means that this request will return a "200 OK" response code with a 1x1 pixel sized image. Normally, Audience Studio pixels returns a response code of "204 No Content", meaning that the request was successful, but no actual content needs to be returned. Not all email clients properly handle a 204 response code, so we're using the "1x1_ad_impression.gif" in our samples here. If you would prefer the "204 No Content" response, you can remove the "1x1_" string, so the location would look like "".

The Impression Pixel is used with various different marketing channels, so it supports collecting data that might not be pertinent with an email campaign – such as a Placement ID or Site ID. Most of the fields in the Impression Pixel are optional. The only required fields are the ConfID and the Campaign ID – although we do suggest you include an Advertiser ID, even if it’s just a hard-coded value for the email channel.

Please note: Not all characters are accepted in the values for these fields.  Please see the accepted values section of the Media Tag Generator help article for what is supported for each field.

If you submit a value with an unaccepted character, than the Audience Studio servers won't be able to process it, and none of the data will be collected for that impression. It is also important to note that all of these trackers are URLs, so values need to be properly URL-encoded as well.

Audience Studio can also translate these ID values into human-readable names in the platform, if you provide us with a translation from the IDs to the names you would like shown.

Since the data collected is used in the Campaign Performance reports, you want to use values that would make sense to your company when the reports are reviewed. If you don’t include a field, such as say the Site ID, than when you clicked into a report that looked at sites, you wouldn’t see any data for your email campaigns. That’s fine, and in some situations, might be the best option. With that in mind, you should decide which if any of the optional fields you’d like to use.

Since campaigns are used in nearly all of the marketing reports, you need to include a Campaign ID to see marketing data in the platform. Many email marketing systems don’t strictly use the idea of a campaign, so you might be wondering what to use instead. It’s fine to use either hard-coded values or related concepts in the place of the campaign. For example, when Email Studio in the Salesforce Marketing Cloud sends out an email campaign, it assigns a Job ID to the email send. So if it made sense for you, you could submit the Job ID for the campaign ID field instead. What values you use – or don’t use - for fields really depends on how you’d like to be able to differentiate the activity in the campaign reporting.

The Conf ID is the Audience Studio Configuration ID for the email marketing channel. You can enter whatever values you would like for the other fields, but the Conf ID must be the correct value for your account. To find the correct value, login to the Audience Studio. Then select Sites from under the Manage menu. You will find the Conf ID in the Config column.

This screen lists all of the Sites and Media Tags that are configured for your account. The Sites are configured to generate Audience Studio Control Tags. Media Tags are configured so Audience Studio can identify the source of different media traffic. There should be a different media tag for your Display campaigns, versus your Paid Search campaigns, versus your Email marketing campaigns, and so on. In the listing, look for the media tag listing for the email channel. Right next to the channel column is the Config column. That text string is your Audience Studio Conf ID for your email marketing channel.

If you don’t see the Sites menu option, it means you’re not set up as an administrator for your account. If you can see the Sites and Media Tags listings, but don’t see a media tag set up for your email marketing channel, it may be that one hasn’t been configured as of yet. In either case, reach out to your Salesforce Audience Studio Solutions team for help.

Since there are a lot of variations between the various email marketing systems and what fields you might choose to include in an Impression Pixel, it’s not easy for Audience Studio to generate the pixel code for you through the platform. However, if you reach out to your Salesforce Audience Studio Solutions team, they will be able to help generate both the Impression and Click Tracker tags.

To deploy the Impression Pixel, you include it in the body of the HTML version of your emails. When a user opens an email and loads the images, a request is sent to the Audience Studio servers and the data is collected into the platform.

Campaign Click Trackers for Emails

The Audience Studio Click Tracker is a redirect script that allows Audience Studio to register that someone clicked on a link before redirecting that user to the final destination. The full format of a Campaign Click Tracker is:[REPLACE_WITH_ADVERTISER_ID]&kxcampaignid=[REPLACE_WITH_CAMPAIGN_ID]&kxplacementid=[REPLACE_WITH_PLACEMENT_ID]&kxsiteid=[REPLACE_WITH_SITE_ID]&kxadid=[REPLACE_WITH_AD_ID]&kxcreativeid=[REPLACE_WITH_CREATIVE_ID]&clk=

The most basic format for the Campaign Click Tracker is:[REPLACE_WITH_ADVERTISER_ID]&kxcampaignid=[REPLACE_WITH_CAMPAIGN_ID]&clk=

As with the Impression Pixel, you can choose to include or discard the optional fields for the Placement, Site, Ad and Creative IDs – but we do recommend that you include an Advertiser ID and a Campaign ID, even if they're only a hard-coded values for all of your email campaigns. This data is used in the reporting in the Audience Studio platform, so what you choose for these values should reflect how you would like to view the reports. For instance, if you would like to be able to distinguish between clicks on different links in an email, you might want to pass in different creative IDs for each link. If you only want to track the overall clicks on any portion of the email, though, then you can use the same values for the Click Tracker in all of the links.

Please note: Again, not all characters are accepted values for these fields, and any characters that are not supported in URLs (such as whitespace characters) need to be properly URL-encoded.

For the Click-through URL field (that is, the &clk= field) the expectation is that the URL will also be properly url-encoded. The Audience Studio Click Tracker will take the url-encoded Click-through URL, decode it, and then redirect the browser to the unencoded URL. This is the way click trackers generally work, so if you are trying to chain together two different click trackers, you may need to double encode the Click-through URL. It's important to test that the click trackers are working as you would expect.

For more information about URL encoding, you can visit:

The URL for the final destination must be included in the Click Tracker after the &clk= field at the end. With out it, the Click Tracker won’t redirect people, and your consumers won’t end up where you want them to go. To deploy the Click Tracker, you would add it to the links in the HTML body of your email. So if your link looked like:

<a href=””>See our new site</a>

With a Campaign Click Tracker, this link would now look like:

<a href=” &kxadvertiserid=12345&kxcampaignid=67890&”> See our new site</a>

User Matching

If you would like Audience Studio to be able to send a list of users to your email marketing system, in order to send out a targeted email message for instance, than the first step is user matching needs to happen between how Audience Studio identifies people and how your email marketing system identifies people. This is normally done by including user matching pixels in your email campaigns. The format for this pixel is:

<img src='' width=0 height=0 style=’display:none’ />

The xxxxxx string will be the partner name Audience Studio has assigned to your email marketing system account and key, and the yyyyyy portion will be the Partner ID that the email marketing system has assigned to the user (typically something like the subscriber ID or a hashed email address). If you need user match pixels, please contact your Salesforce Audience Studio Solutions team, and we will set them up for you.

The example user matching pixel above uses the HTTP protocol, but HTTPS is also a supported protocol for all Salesforce Audience Studio URLs.

Implementing the Trackers

These instructions are the generalized instructions for how to implement the trackers in any email system. There are also specific instructions that will walk you through how to implement the trackers in Salesforce Marketing Cloud's Email Studio, SendGrid, and MailChimp.

The user match, impression, and event pixels all need to be included in the body of the HTML version of your email. If they are included the text version, they would never be fired, and Audience Studio would never receive the data. Not to mention, the pixel code would be visible - and probably distracting - to your subscribers.

If at all possible, we suggest that you use email templates, so you can include these pixels in the template instead of having to include them manually to each email. You don't want to include these pixels in the <head></head> section of your HTML email (assuming you use full HTML document structure code) because some email systems, such as Gmail, automatically remove that section of code.

The exact placement of the pixels in the email body doesn't matter too much, but we suggest you include them at the top of the email. The Click Tracker must be added to the <a href= of any link you want the clicks tracked from. You can use the same Click Tracker to track all of the links, or you can choose to only track some of the links. If you don't want to use the Click Tracker at all, it may be possible to collect the click data off of the landing page, if it includes Audience Studio tracking as well. Contact your Salesforce Audience Studio Solutions Team to discuss this further.

An alternative to using an <img tag to make the pixel call to Audience Studio is to use a <span tag instead, and set the background image of the span to the Audience Studio pixel you are using. In other words, instead of using:

<img src='' width=0 height=0 style='display:none;' />

You could use:

<span style="background-image:url(''); display:inline-block; width:0px; height:0px"></span>

This can help if you run into any display issues in older email clients.

That's all that's really involved in adding the trackers to your emails. The only other tip we can offer is to make sure to send test versions of your email out, and try and check them in as many email clients and scenarios as you can. Unfortunately, there's a lot more variation on how email clients display content than with web browsers.

Things To Note

Here are a few items to keep in mind when collecting data from emails:

  • JavaScript is not supported in the majority of email clients, so you always want to use the pixel version of a tag.
  • Gmail caches images, which has an impact on the Audience Studio tags.  The first time an email is opened in Gmail, the request will be passed along to the Audience Studio servers.  After that first time, Google will deliver a response out of their image cache, instead of passing the request along to the Salesforce servers.  This means that Google allows for the capturing of unique opens in Gmail, but not total opens.  It also means that if  you look at the image requests in Gmail, you won't see requests coming to the Audience Studio servers, but rather the Google proxy servers (at
  • Most webmail clients, such as Gmail, block external calls for CSS style sheets, so you want to embed your CSS into the email or put the CSS styling inline.
  • Gmail strips out the <head></head> tags from an HTML email, so you always want to include the trackers in the body of the email.
  • Email clients are not as universally consistent about how they display HTML and CSS. Because of this, you always want to send test campaigns and look at the test emails in a variety of different browsers.
  • If you want to track email campaigns without using an ad_impression.gif pixel, it is possible to collect some campaign information using UTM parameters in the click-through URLs instead. For more information on how to do this, please talk to your Solutions team.
  • Many email clients cache images. Because of this, Audience Studio would be able to see the first time a user opened an email, but not necessarily every time they opened an email. Since that first open is usually the most important, this isn’t usually a problem, but is something to keep in mind.
  • People who read the text only versions of emails will not be tracked because there isn’t a mechanism to send the data back to the Audience Studio servers in that scenario. 
Have more questions? Submit a request


Article is closed for comments.