Solved

Splitting Event Data for Button Links

  • 26 January 2024
  • 2 replies
  • 22 views

Badge

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 }}

 

icon

Best answer by saulblum 28 January 2024, 20:37

View original

2 replies

Userlevel 7
Badge +44

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

Userlevel 4
Badge +7

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.

Reply