Skip to main content
Solved

Splitting Event Data for Button Links


MoLove
Contributor I
Forum|alt.badge.img+1

I have some event data that pulls in a link, l `https://molove.com/{custom_link_here}`. Is there a clever way to split this data as I want to add /de to my link in some instances, i.e. `https://molove.com/de/{custom_link_here}.

I tried the following django but it always results in an error. What am I missing here? 

 

1: Replace the Base Url with the one containing de

2: Split the URL and add in de

https://molove.com/de/{{ event.custom_link|default:"https://molove.com/"|replace("https://molove.com", "") }}
{% set base_url, path = event.custom_link|default:"https://molove.com/"|split('/', 1) %}
{{ base_url }}/de/{{ path }}

 

Best answer by saulblum

This is the more up-to-date filter list:

https://developers.klaviyo.com/en/docs/glossary_of_variable_filters

You can use most of the django filters at https://docs.djangoproject.com/en/5.0/ref/templates/builtins/

set is not a filter you can use in a template, though you can use with.

Also if the URL includes // then splitting on / might include the protocol and not just the whole base URL.

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

Omar
Partner - Platinum
Forum|alt.badge.img+46
  • 2025 Champion
  • 494 replies
  • January 27, 2024

Hi @MoLove,

I would check the concat option here: https://developers.klaviyo.com/en/v1-2/docs/glossary-of-variable-filters

 

Omar Lovert // Polaris Growth // Klaviyo Master Platinum Partner

We help with e-commerce growth through CRO, Klaviyo and CVO


Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • Answer
  • January 28, 2024

This is the more up-to-date filter list:

https://developers.klaviyo.com/en/docs/glossary_of_variable_filters

You can use most of the django filters at https://docs.djangoproject.com/en/5.0/ref/templates/builtins/

set is not a filter you can use in a template, though you can use with.

Also if the URL includes // then splitting on / might include the protocol and not just the whole base URL.