CMS Development

GPyb
Member

Dynamic parameter in CTA button

SOLVE

Hi,

 

I need to solve the following problem. We are using the CTA button on LP. When the user clicks it, he is redirected to our target page. And I need to be able to add a dynamic parameter using JS code on the LP so that it will be added as a GET to the destination link (our target page) to which the user will be redirected after clicking on the CTA button.

 

Can someone write step by step on how to add a dynamic parameter to the link a user will be taken to when they click on the CTA?

 

 

0 Upvotes
1 Accepted solution
amwilie
Solution
Key Advisor | Elite Partner
Key Advisor | Elite Partner

Dynamic parameter in CTA button

SOLVE

@GPyb 

 

Due to the way HubSpot CTAs function it'd make more sense to create a custom module instead. You wouldn't even need Javascript to add the dynamic parameter then. If you still need HubSpot tracking on the button there's custom events and tracking URLs.

 

Just create a module and then the following set up should get you custom button with a dynamic parameter:

 

hubspot-custom-button-module.png

 

You'll just need to change '?parameter=' ~ site_settings.company_name with whatever parameter name and variable you're wanting to use. Also add some CSS to style the button.

 

 

If this answer solved your question, please mark it as the solution!

border

Alyssa Wilie

Web Developer at LyntonWeb

Kickstart your success on HubSpot's CMS with a theme by the HubSpot experts at Lynton


View solution in original post

1 Reply 1
amwilie
Solution
Key Advisor | Elite Partner
Key Advisor | Elite Partner

Dynamic parameter in CTA button

SOLVE

@GPyb 

 

Due to the way HubSpot CTAs function it'd make more sense to create a custom module instead. You wouldn't even need Javascript to add the dynamic parameter then. If you still need HubSpot tracking on the button there's custom events and tracking URLs.

 

Just create a module and then the following set up should get you custom button with a dynamic parameter:

 

hubspot-custom-button-module.png

 

You'll just need to change '?parameter=' ~ site_settings.company_name with whatever parameter name and variable you're wanting to use. Also add some CSS to style the button.

 

 

If this answer solved your question, please mark it as the solution!

border

Alyssa Wilie

Web Developer at LyntonWeb

Kickstart your success on HubSpot's CMS with a theme by the HubSpot experts at Lynton