APIs & Integrations

nutan1
Participant

Dynamically change cta url

In my application user select country from dropdown and click CTA, On CTA click user will navigate to respective country page based on country selection.How to work with such a situation in hubspot.

0 Upvotes
3 Replies 3
Manobyte
Contributor | Diamond Partner
Contributor | Diamond Partner

Dynamically change cta url

I think your best option If you need them to be CTA's would be to create separate CTA's for the countries, rather then trying to change the url on an existing one. But I think in this instance it might be better to use a normal link, with a tracking URL if you need to get click information on it. Since this would be easier to edit dynamically with a script. If you are using a dropdown, you might also want to consider using a form that redirects based on the selected options value, and set the value to the url or tracking url you set up. Something like this;

<select>
<option value="www.URL.com">USA</option>
<option value="www.CanadaURL.com">Canada</option>
</select>

nutan1
Participant

Dynamically change cta url

I am still confused with given solution.Can you check attached screenshot.In attached screenshot enter country contains dropdown with country name and country flag(custom drop down created using html).Explore more is hubspot CTA.Here first user select country and click explore more button.On button click respective country related page will be open.Give me a solution,how to work with such a situation

0 Upvotes
Manobyte
Contributor | Diamond Partner
Contributor | Diamond Partner

Dynamically change cta url

In this case I think it would be better to use a link styled to look like a CTA and change the url with a script similar to this.

var new_url = 'https://www.NewURL.com';
$("#ID").attr("href", new_url);

where the var would update based on your custom dropdown changing.

I dont think this will work to change the url of a cta though, because it is loaded in with code its self. You will need to use a regular link. But you could use it with a tracing url like I explained in my first response.

0 Upvotes