# How do I trigger a pop-up CTA in a custom module?

**URL:** <https://community.hubspot.com/t/how-do-i-trigger-a-pop-up-cta-in-a-custom-module/125331>\
**Category:** CMS Development\
**Created:** [February 3, 2025, 8:08pm UTC](https://community.hubspot.com/t/how-do-i-trigger-a-pop-up-cta-in-a-custom-module/125331 "2025-02-03T20:08:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DCardinal3](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dcardinal3/32/201703_2.png) [@DCardinal3](https://community.hubspot.com/u/DCardinal3)\
**Post date:** [February 3, 2025, 8:08pm UTC](https://community.hubspot.com/t/how-do-i-trigger-a-pop-up-cta-in-a-custom-module/125331/1 "2025-02-03T20:08:32Z")

</div>

I’m trying to add the ability to trigger a pop-up CTA from a custom-coded module but I can’t figure out how to get it to work. From what I can tell there are 2 ways to do this:

The first is to use the URL parameter and select the ‘type’ as Pop-up CTA.

 ![DCardinal3_0-1738612385995.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/4/74468b0a90d21215143d9e7de67cebdc0b619682.png)

but I don’t really know what I’m supposed to do with this - which parameter from the URL do I use and how do I trigger it? If I just use it like I normally would use a URL field:

`<a href="{{ module.url.href }}">Click here</a>`

It doesn’t seem to have an href value (just goes to an empty page) and I can’t find any documentation regarding this field so I’m not really sure what to do with this.

The other way would be to utilize the `hs-cta-trigger-button` classes for ‘external’ sites - but if I put these classes in the module, nothing happens when I click on the button. No console errors or anything that I can see to point me in the right direction, just nothing happens.

`<button class="hs-cta-trigger-button hs-cta-trigger-button-1234567">Click here</button>`

I feel like I must be missing something glaringly obvious, but I can’t figure out what it is. Any help would be appreciated!

I know you can accomplish this with the default ‘button’ module but I would like to avoid this as it doesn’t work for the way I’ve structured everything and I want to have more control over the styling.

---

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [February 3, 2025, 10:21pm UTC](https://community.hubspot.com/t/how-do-i-trigger-a-pop-up-cta-in-a-custom-module/125331/2 "2025-02-03T22:21:09Z")

</div>

Hi @DCardinal3,

if you create a link option and copy the whole snippet(works with every field; but most times “value” is enough) and paste it into the module.html, you will see the correct variable and - in this case - the whole link structure.

 ![Bildschirmfoto 2025-02-03 um 23.15.07.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/0/606f5607c6f2a549b89fddffb75999ecf20d40c6.png)

In my example(screenshot) the copied snippet looks like this:

```lia-code-sample
{% set href = module.link_field.url.href %}
{% if module.link_field.url.type is equalto "EMAIL_ADDRESS" %}
 {% set href = "mailto:" + href %}
{% endif %}
<a
 {% if module.link_field.url.type is equalto "CALL_TO_ACTION" %}
 href="{{ href }}" {# The href here is not escaped as it is not editable and functions as a JavaScript call to the associated CTA #}
 {% else %}
 href="{{ href|escape_url }}"
 {% endif %}
 {% if module.link_field.open_in_new_tab %}
 target="_blank"
 {% endif %}
 {% if module.link_field.rel %}
 rel="{{ module.link_field.rel|escape_attr }}"
 {% endif %}
 >
 Link text
</a>

```

the important part is the info: “The href here is not escaped as it is not editable and functions as a JavaScript call to the associated CTA”.

This means that you’re on the right track with your first option. If you have only the Pop-Up-CTAs as option for this button, you can write the code like this:

```lia-code-sample
{% set href = module.link_field.url.href %}

<a href="{{ href }}" >Click here</a>

```

best,

Anton

---

<div class="post-metadata">

**Author:** ![DCardinal3](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dcardinal3/32/201703_2.png) [@DCardinal3](https://community.hubspot.com/u/DCardinal3)\
**Post date:** [February 12, 2025, 4:55pm UTC](https://community.hubspot.com/t/how-do-i-trigger-a-pop-up-cta-in-a-custom-module/125331/3 "2025-02-12T16:55:14Z")

</div>

Amazing, thank you so much!
