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
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | 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.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

View solution in original post

3 Replies 3
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | 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.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
MWallace58
Participant

Dynamic parameter in CTA button

SOLVE

Hey Alyssa! 

Thank you for sharing this solution. I am curious could this approach also work for inseting a dynamic button into a hubspot automated email too?

0 Upvotes
alyssamwilie
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Dynamic parameter in CTA button

SOLVE

Yes, this should work on automated emails as well.

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

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
0 Upvotes