Dynamics icon_url

Hi, is it possible to create a dynamic iron_url?

I’m using the link parameter and for the icon_url I wanted to create a conditional statement.

For example: Let’s say that sources are social medias.

If ${sources} = A, then bring the icon from A, else if ${sources} = B, then bring the icon from B.

My first idea was defining a dimension using HTML parameter using liquid conditional statements and then referencing it in the icon_url, but it didn’t work.

Solved Solved
0 1 292
1 ACCEPTED SOLUTION

Hey Vinicius, very cool use case to have a dynamic icon_url! 

You can use liquid variables in the icon_url parameter to achieve this, namely a liquid {% if %} evaluator and ._value. 

For example: 

icon_url: 
"{% if order_items.status._value == 'Complete' %}
https://logo-core.clearbit.com/looker.com
{% else %}
https://logo-core.clearbit.com/google.com
{% endif %}"

This will display Looker’s logo when order_items.status = Complete, and Google’s logo otherwise. 

View solution in original post

1 REPLY 1

Hey Vinicius, very cool use case to have a dynamic icon_url! 

You can use liquid variables in the icon_url parameter to achieve this, namely a liquid {% if %} evaluator and ._value. 

For example: 

icon_url: 
"{% if order_items.status._value == 'Complete' %}
https://logo-core.clearbit.com/looker.com
{% else %}
https://logo-core.clearbit.com/google.com
{% endif %}"

This will display Looker’s logo when order_items.status = Complete, and Google’s logo otherwise. 

Top Labels in this Space
Top Solution Authors