Usin CTA to pass a HubL variable?

Highlighted
Regular Contributor

I have ~20 process-related pages, each with a CTA to our contactUs page. On each of these pages, I define the variable 'process' per:

{% set process = "brazing" %} (or soldering, annealing, etc.)

On the Landing page, the form looks for a value for 'lead_origin'

Is there any way to write the CTA URL to carry this page-specific value to the landing page per:

https://www.ambrell.com/contact-us?lead_origin={{process}}

I get an 'unknown' error when I try the above URL

 

Thanks for your time

 

WmFLanigan

Reply
0 Upvotes
8 Replies 8
Regular Advisor

I know you can use parameters on the redirect URL but I think you might need to add in the object for your custom one. 

 

When you click into Developer Info on your landing page (see below): 

 

Developer Info.jpg

 

You should be able to find your custom parameter:

 

Developer Info (2).jpg

 

Then use dot notation to drill down from the top of the tree (content) to the value. I'd say it should look something like this: 

 

{{content.widgets.process.body.value}}

More on this here.

 

Hopefully that should help Smiley Happy

 


Stephanie O'Gay Garcia

HubSpot CMS Design & Development

Website | Contact

 

If this helped, please mark it as the solution to your question, thanks!

Regular Contributor

Stepanie,

Thanks very much for your help, but...

I tried your suggestion, but on the landing page in question,

https://www.ambrell.com/contact-us 

"process" does not appear in the page (using JSONView, too). I tried viewing 'Developer Info" for this page after arriving from one of my referring pages

https://www.ambrell.com/induction-heating-applications/annealing

and, still, no sign of "process".

I also tried editing the CTA URL per 

https://www.ambrell.com/fr/contact?lead_origin={{content.process}}

as a test, but that, too was rejected, 'unknown error'

 

WmF

Reply
0 Upvotes
Regular Advisor

Where are you defining the "process" variable? If it's not appearing in the Developer Info it might not be available on the page. 

 

What happens if you try to print it out? You could temporarily put it in a hidden div or something like this:

 

 

<div style="visibility: hidden; opacity: 0;">{{ process }}</div>

 

 


Stephanie O'Gay Garcia

HubSpot CMS Design & Development

Website | Contact

Reply
0 Upvotes
Regular Contributor

Stephanie,

Thanks again for your time.

As I mentioned at the start, I define process per

{% set process = "brazing" %} (or soldering, annealing, etc.)

in the head html of each process-related page.

I don't understand the <div> part of your reply.

WmF

Reply
0 Upvotes
Regular Advisor

I haven't usually tried variables in the head but mine are also not outputting so I'm not too sure.

Perhaps you could try using a text or choice module with export_to_template_context instead. I tested adding this to the head: 

 

{% text "process", value="brazing", export_to_template_context=True %}

And the {{content.widgets.process.body.value}} to the URL:

 

hublinurl.jpg

 

And that worked: 

 

 redirecturl.jpg

 


Stephanie O'Gay Garcia

HubSpot CMS Design & Development

Website | Contact

 

If this helped, please mark it as the solution to your question, thanks!

Reply
0 Upvotes
Regular Contributor

Stephanie,

Interseting; I'll give it a try. Thanks!

WmF

Reply
0 Upvotes
Regular Contributor

Stephanie,

Again, the CTA URL toll rejects this construction

fault.png

 

Thanks anyway!

 

WmF

Reply
0 Upvotes
Regular Advisor

I've found that I have trouble saving personalisation tokens in the redirect URL on the form itself, but it tends to work when you update the redirect URL directly on the template or page module.

 


Stephanie O'Gay Garcia

HubSpot CMS Design & Development

Website | Contact

Reply
0 Upvotes