Example 1 — Dynamically set City based on IP
Top = Default (no Target) · Bottom = Target variant
Default
Huge discounts in all major cities today
Huge discounts in all major cities today
Target variant
Huge discounts in all major cities today
Huge discounts in all major cities today
Example 2 - Dynamically set value from mbox parameter
Showing value from dynamicData mbox parameter:
(waiting for Target)
Tips & Best Practices — Dynamic Tokens in HTML Offers
1) What kinds of tokens can you use?
${profile.x}
for in-mbox profile parameters passed on the request.${user.x}
for values from profile scripts (server-side logic).${mbox.paramName}
for mbox (page) parameters sent directly from the page.- Campaign/experience metadata:
${campaign.name}
,${campaign.recipe.name}
,${offer.name}
, etc. - Built-ins/behavior:
${user.sessionId}
,${user.endpoint.categoryAffinity}
, etc.
2) Defaults & empty values
- Fallback:
${user.testAttribute default="All Items!"}
- If an empty value is valid and you want to show it:
${user.testAttribute default="All Items!" show_blank="true"}
3) Encoding (avoid breaking JavaScript)
- Escape or unescape when needed:
${user.encodedValue encode="unescape"}
or${user.unencodedValue encode="escape"}
4) Recommendations designs: escape the dollar sign
- In Recommendations designs you must escape the token:
\${user.endpoint.lastViewedEntity}
5) Customer Attributes (CRM data) in offers
- Directly in an HTML offer (no script needed) — use the
crs
token:
${crs.<dataSourceName>.<attributeName>}
Example:${crs.Loyalty.tier}
- Via a profile script (gives you logic + fallback), then reference with
${user.<scriptName>}
:
Profile Script “loyaltyTier”:return crs.get('Loyalty.tier') || 'Basic';
In your offer HTML:${user.loyaltyTier}
- Important: use the **data source name** (not alias) in
crs.get()
. If the data source name contains spaces, the token form may strip spaces when referenced in APIs.