Skip to main content
MoLove
Contributor I
Contributor I
January 26, 2024
Solved

Splitting Event Data for Button Links

  • January 26, 2024
  • 2 replies
  • 69 views

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

 

    This topic has been closed for replies.
    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.

    2 replies

    Omar
    Partner - Platinum
    2025 Champion
    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

    Helping E-commerce brands maximize Lifetime Value & Profits with Klaviyo, CRO & CVO - Get your free Audit - https://link.polarisgrowth.com/free-audit
    saulblumAnswer
    Klaviyo Employee
    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.