TreatAsContentArea

This function creates a static Content Area that is stored by key for the duration of the send. It will evaluate AMPscript included in the content retrieved, with a limit of 300 unique variations. If there are more than 300 unique variations, any subsequent versions will be rendered as the first.

TIP: You may use this function instead of TreatAsContent if you are retrieving content that is the same for every Subscriber in your sending audience.

Arguments

TreatAsContentArea(1,2,3)

Ordinal Type Required Description
1 String True Key value that identifies the content specified by the second argument
2 String True Content to be stored
3 String False Name of the Impression Region to wrap around content

Example

This example retrieves a test XML payload from a web service and replaces certain characters to display.

%%[

var @xmlContent
set @xmlContent = httpget("http://httpbin.org/xml")
set @xmlContent = replace(replace(@xmlContent, ">", "&gt;"), "<", "&lt;")

]%%
xmlContent:
%%=TreatAsContentArea("XMLContent", @xmlContent, "XML Content")=%%

Output

xmlContent:
&lt;?xml version='1.0' encoding='us-ascii'?&gt;

&lt;!--  A SAMPLE set of slides  --&gt;

&lt;slideshow
    title="Sample Slide Show"
    date="Date of publication"
    author="Yours Truly"
    &gt;

    &lt;!-- TITLE SLIDE --&gt;
    &lt;slide type="all"&gt;
      &lt;title&gt;Wake up to WonderWidgets!&lt;/title&gt;
    &lt;/slide&gt;

    &lt;!-- OVERVIEW --&gt;
    &lt;slide type="all"&gt;
        &lt;title&gt;Overview&lt;/title&gt;
        &lt;item&gt;Why &lt;em&gt;WonderWidgets&lt;/em&gt; are great&lt;/item&gt;
        &lt;item/&gt;
        &lt;item&gt;Who &lt;em&gt;buys&lt;/em&gt; WonderWidgets&lt;/item&gt;
    &lt;/slide&gt;

&lt;/slideshow&gt;