How to properly use Salesforce Marketing Cloud surveys

Erik H.AMPscript, Salesforce Marketing CloudLeave a Comment

You may have noticed that there is a built in survey feature in Salesforce Marketing Cloud that hardly anyone uses.  This is primarily due to the how the survey is added to the email, rather than generating an external landing page for the survey the tool embeds the the HTML form directly into the body of the email.  Many of the popular email clients do not support HTML forms in the email body which leads to a poor survey experience for subscribers.

The good news is that there is a way to use the built in survey functionality while giving your subscribers a great experience, it just requires some AMPscript.  To fix the survey experience, we’ll use an if/else logic block to hide the survey form for all message contexts except the view as a webpage context, instead in the regular email context we will show a CTA button that is linked to the %%view_email_url%% personalization string.

Begin by creating a new survey in the Classic Content Builder > My Surveys.

Add your questions to the survey.

Create a new email for your survey then add your survey content to the email.

Click on the survey content area then click “Modify Content”, use your preferred editing method for the next step.

Now, wrap the form HTML in the following AMPscript, add your CTA button in the ‘else’ block and make sure it is linked to %%view_email_url%%.

<!-- show the survey only if context is view as a web page -->
%%[ if _messagecontext == "VAWP" then ]%%

<form name="@@SecureSurveyID:88" action="@@SurveyAction:" method="POST">
	<font size="2" face="Arial">
	1. What is your age?
	<input name="@@QuestionID:273:What+is+your+age%3f:0:RADIODATA:0" value="18-24 years old" type="radio" />18-24 years old
	<input name="@@QuestionID:273:What+is+your+age%3f:0:RADIODATA:0" value="25-34 years old" type="radio" />25-34 years old
	<input name="@@QuestionID:273:What+is+your+age%3f:0:RADIODATA:0" value="35-44 years old" type="radio" />35-44 years old
	<input name="@@QuestionID:273:What+is+your+age%3f:0:RADIODATA:0" value="45-54 years old" type="radio" />45-54 years old
	<input name="@@QuestionID:273:What+is+your+age%3f:0:RADIODATA:0" value="55+ years old" type="radio" />55+ years old
	
	2. Overall, how satisfied or dissatisfied are you with our company?
	<input name="@@QuestionID:274:Overall%2c+how+satisfied+or+dissatisfied+are+you+with+our+company%3f:0:RADIODATA:0" value="Very satisfied" type="radio" />Very satisfied
	<input name="@@QuestionID:274:Overall%2c+how+satisfied+or+dissatisfied+are+you+with+our+company%3f:0:RADIODATA:0" value="Somewhat satisfied" type="radio" />Somewhat satisfied
	<input name="@@QuestionID:274:Overall%2c+how+satisfied+or+dissatisfied+are+you+with+our+company%3f:0:RADIODATA:0" value="Neither satisfied nor dissatisfied" type="radio" />Neither satisfied nor dissatisfied
	<input name="@@QuestionID:274:Overall%2c+how+satisfied+or+dissatisfied+are+you+with+our+company%3f:0:RADIODATA:0" value="Somewhat dissatisfied" type="radio" />Somewhat dissatisfied
	<input name="@@QuestionID:274:Overall%2c+how+satisfied+or+dissatisfied+are+you+with+our+company%3f:0:RADIODATA:0" value="Very dissatisfied" type="radio" />Very dissatisfied
	
	<center><input value="Submit" type="submit" /></center></font><center><font size="1" face="Arial">If you do not receive a confirmation page after clicking submit, please click <a href="%%view_email_url%%">here</a>.</font></center>
</form>

<!-- for all other contexts, show CTA button linked to VAWP -->
%%[ else ]%%

<div style="padding-top: 15px; padding-bottom: 15px;"><center><a href="%%view_email_url%%"><img src="http://image.S7.exacttarget.com/lib/fe8d1372756c077b7d/m/1/button.png" title="button" alt="button" vspace="0" hspace="0" border="0" /></a></center></div>

%%[ endif ]%%

Your email should look like this when finished.

Now that the AMPscript has been added, try sending yourself a send preview.  You should only see the CTA button in your email client and you should only see the survey when viewing as webpage.

Email Context:

VAWP Context:

You can view survey responses in Email App > Tracking > Sends, they will be included in the email send tracking report.

 

Leave a Reply

Your email address will not be published. Required fields are marked *