This function forces AMPscript and personalization strings to be evaluated in the specified input string.



Ordinal Type Required Description
1 String True String to evaluate

Example 1


var @contentMath
set @contentMath = "%%=add(1,3)=%%"

contentMath (static): %%=v(@contentMath)=%%
<br>contentMath (evaluated): %%=treatascontent(@contentMath)=%%


contentMath (static): (raw): %%=add(1,3)=%%
<br>contentMath (evaluated): 4

Example 2

A common use of the TreatAsContent function is to leverage the httpgetwrap| URL prefix in your Content Area. The intent of this prefix is to ensure Subscriber clicks are properly tracked in this external content.

There is a key consideration to using httpgetwrap: it only tracks the first 100 unique URLs in the send. If the prefix is being used in conjunction with the Web Analytics Connector, it’s unlikely that click activity on these prefixed links will be completely tracked. If the business rule is not enabled, then these external links will not be tracked at all.

NOTE: The httpgetwrap| prefix must be enabled by Marketing Cloud Support. The special business rule is called WRAP_HTTPGET_URLS.


var @contentWithLink
set @contentWithLink = 'Click here: <a href="httpgetwrap|"></a>'

contentWithLink: %%=TreatAsContent(@contentWithLink)=%%


contentWithLink: Click here: <a href=""></a>