Content Functions

Use the Content functions to modify and retrieve content.

In Marketing Cloud Engagement, use these functions to interact with content in Content Builder, Classic Content Areas, and your Portfolio.

Some of these functions can also be used in Marketing Cloud Next. In Marketing Cloud Next, these functions interact with content in your marketing Content Workspace.

This table lists all of the AMPscript functions related to managing content. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function.

Function NameDescriptionEngagementNext
AttachFile()Attaches a file to an outgoing email message.✅ Yes❌ No
BarcodeUrl()Generates a barcode based on an input string.✅ Yes❌ No
BeginImpressionRegion()Denotes the beginning of a region to track with impression tracking.✅ Yes❌ No
BuildOptionList()Creates a set of <option> tags that you can integrate into an HTML form on a CloudPage.✅ Yes❌ No
BuildRowsetFromJson()Creates a rowset from JSON data.✅ Yes✅ Yes
BuildRowsetFromString()Creates a rowset from a character string.✅ Yes❌ No
BuildRowsetFromXml()Creates a rowset from XML data.✅ Yes❌ No
ContentArea()Returns content contained in the specified content area by referencing its ID.✅ Yes❌ No
ContentAreaByName()Returns content contained in the specified content area by referencing its name.✅ Yes❌ No
ContentBlockById()Returns the content contained in a content block by referencing its ID.✅ Yes✅ Yes
ContentBlockByKey()Returns the content contained in a content block by referencing its key.✅ Yes✅ Yes
ContentBlockByName()Returns the content contained in a content block by referencing its name.✅ Yes✅ Yes
EndImpressionRegion()Denotes the end of an impression tracking region.✅ Yes❌ No
GetPortfolioItem()Returns the content of a file in your Portfolio.✅ Yes❌ No
Image()Returns the path to an image from your Portfolio by referencing its ID.✅ Yes❌ No
ImageById()Returns the path to an image from Content Builder by referencing its ID.✅ Yes❌ No
ImageByKey()Returns the path to an image from Content Builder by referencing its key.✅ Yes❌ No
TransformXml()Apply an XSL transformation to XML data.✅ Yes❌ No
TreatAsContent()Treats a string as though it came in from a content area.✅ Yes❌ No
TreatAsContentArea()Treats content from a data extension as though it came from a content area.✅ Yes❌ No
WAT() and WATP()Returns the values of a Web Analytics Tracking (WAT) parameter.✅ Yes❌ No