Skip to main content
Contributor I
July 4, 2023
Solved

I would like to trigger a popup by clicking on specific text

  • July 4, 2023
  • 3 replies
  • 277 views

Hi,

 

I have tried this solution on Klaviyo website but this is not working at somehow. I don't have the expertise to code I understand it a bit but I don't know why It is not working.

I would like to have a pop-up which is triggered by a text. The pop-up gives more explanation to the customer.

<button class="klaviyo_form_trigger">Wat is je maat?</button>

 

<script type="text/javascript">
document.querySelector('.klaviyo_form_trigger').addEventListener('click', function (){
window._klOnsite = window._klOnsite || [];
window._klOnsite.push(['openForm', 'TKGULa']);
});
</script>

I guess I do something wrong but I don't know what. 

    This topic has been closed for replies.
    Best answer by David To

    Great suggestions @bluesnapper!

    @Wesley, by “shopbasket” do you mean the cart page? If so, then this sounds like there’s some coding conflict on your site with that Klaviyo code. Most likely caused by another script tied to the text or behavior.

    I would suggest working alongside your developer to review your site code closely to resolve this conflict. If you need an introduction to a developer, we have a large network of Klaviyo Partners who can help in this area. 

    I hope this helps!

    David

    3 replies

    bluesnapper
    Partner
    Champion & Partner
    July 4, 2023

    Hi @Wesley 

    The script looks good to me!

    Some things to check:

    1. Is the form TKGULa published (status of ‘Live’)?
    2. Is your browser blocking javascript?
    3. Do you have any other Klaviyo pop-ups on your site that are working OK?
    4. Related to 3, have you enabled onsite tracking ? More info here: https://help.klaviyo.com/hc/en-us/articles/360026474752

    Hope one of those fixes your issue!

    Regards

    Andy

    https://bluesnapper.com - Klaviyo Champion '24 & Partner
    WesleyAuthor
    Contributor I
    July 4, 2023

    Everything is correct but at some point the pop-up triggers the shopbasket. Which mean the customer goes straight to the shop basket.

    David To
    Klaviyo Employee
    David ToAnswer
    Klaviyo Employee
    July 5, 2023

    Great suggestions @bluesnapper!

    @Wesley, by “shopbasket” do you mean the cart page? If so, then this sounds like there’s some coding conflict on your site with that Klaviyo code. Most likely caused by another script tied to the text or behavior.

    I would suggest working alongside your developer to review your site code closely to resolve this conflict. If you need an introduction to a developer, we have a large network of Klaviyo Partners who can help in this area. 

    I hope this helps!

    David