I am trying to create a variable in HTML and use the value in multiple places in HTML.
{% let Linktags = "abc,def" %}
<a href="https://www.qatarairways.com/"
target="_blank"
data-tags="{{ Linktags }}"
style="color:#8C919B; text-decoration:underline;"
data-tracking-type="MIRROR_PAGE"
data-nl-type="mirrorPage">
View in browser
</a>
I validated this HTML and there is no syntax issue but it is treating like string data-tags="{{ Linktags }}". instead of getting value from actual variable. I also tried below syntax but it is not working. Any idea how to make this work ?
<a href="https://www.qatarairways.com/"
target="_blank"
data-tags="{%=Linktags %}"
style="color:#8C919B; text-decoration:underline;"
data-tracking-type="MIRROR_PAGE"
data-nl-type="mirrorPage">
View in browser
</a>
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Mario248 ,
As I know, In AJO, personalization inside content templates is powered by a Handlebars-based expression language.
That means:
1. You cannot define or assign your own variables in the template using syntax like `{% let ... %}` or `{%= ... %}` — these are not supported in AJO.
2. You can use either:
- Hardcoded (static) strings.
- Dynamic data coming from your profile, event, or context attributes, for example:
- Predefined functions.
Hope it will help you.
Kr,
Parvesh
Hi @Mario248 ,
As I know, In AJO, personalization inside content templates is powered by a Handlebars-based expression language.
That means:
1. You cannot define or assign your own variables in the template using syntax like `{% let ... %}` or `{%= ... %}` — these are not supported in AJO.
2. You can use either:
- Hardcoded (static) strings.
- Dynamic data coming from your profile, event, or context attributes, for example:
- Predefined functions.
Hope it will help you.
Kr,
Parvesh
Hi Parvesh,
Has a deep analysis been made about this topic?
Since the URL provided contains the "utm_source" parameter equal to "chatgpt.com", I am afraid it didn't.
Can you please give us more details about how data-tags can be set dinamically inside the html?
Thank you,
Mario
Views
Replies
Total Likes
Hi,
I have exactly the same issue and I tried the following tests:
- data-tags="{{variable}}"
- data-tags="{{{variable}}}"
- data-tags={{variable}}
- data-tags={{{variable}}}
- data-tags="{{profile._tenant.attribute}}"
- data-tags="{{{profile._tenant.attribute}}}"
- data-tags={{profile._tenant.attribute}}
- data-tags={{{profile._tenant.attribute}}}
- data-tags="{{store._tenant.lookupAttribute}}"
- data-tags="{{{store._tenant.lookupAttribute}}}"
- data-tags={{store._tenant.lookupAttribute}}
- data-tags={{{store._tenant.lookupAttribute}}}
Where store._tenant.lookupAttribute is an attribute of a dataset enabled for lookup.
None of them works. Am I mistaking something? Otherwise it seems it is not true that dynamic data can be used.
Perhaps, I am experiencing this issue only in data-tags (dynamic href, instead, is OK).
Thanks,
Mario
Views
Replies
Total Likes