TreatAsContent
This function forces AMPscript and personalization strings to be evaluated in the specified input string.
Argument
TreatAsContent(1)
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)=%%
Output
contentMath (static): %%=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 Parameter Manager, 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 calledWRAP_HTTPGET_URLS
.
%%[
var @contentWithLink
set @contentWithLink = 'Click here: <a href="httpgetwrap|https://limedash.com">limedash.com</a>'
]%%
contentWithLink: %%=TreatAsContent(@contentWithLink)=%%
Output
contentWithLink: Click here: <a href="https://limedash.com">limedash.com</a>