Auto-populate a contact property in landing page from url parameter

Hi,

On a hubspot landing page, I’m displaying a company logo based on a contact property (using the clearbit logo api).

<img src="//logo.clearbit.com/{{contact.company_domain}}" width="128" height="128">

It works perfectly when the contact exists and has this property filled.

Problem: I want to be able to display any logo, even if the contact doesn’t exist yet. I was thinking forcing it by adding url parameter into my landing page URL like below (just like we do when auto-populating forms):

http://mypage.com/anything?{{contact.company_domain}}=nike.com

or maybe this?

http://mypage.com/anything?company_domain=nike.com

but it doesn’t work. Any advices or quick hacks to achieve this?

Thanks!

Hi Jerome,

Since your problem is when a contact does not exist, why don’t you try this?

{{request.query_dict.company_domain}}

We should to fetch values from the URL into our tracking codes.

If I’ve understood you well, this should do it.

Hey @Javier_Revilla,

Thanks for answering. I’ve tried this in my landing page url:

http://get.myfeelback.com/survey-preview-query?company_domain=nike.com

And I’ve tried each of these lines in my template, with no luck:

<img src="//logo.clearbit.com/{{request.query}}">
<img src="//logo.clearbit.com/{{request.query_dict}}">
<img src="//logo.clearbit.com/{{request.query_dict.company_domain}}">
<img src="//logo.clearbit.com/{{request.query_dict.get('company_domain')}}">

I’ve found some interesting info here, if you’re interested. I’m stuck, any help appreciated!

Hi,

I can’t find why it isn’t working for you. For example, we are just using this:

{{request.query_dict.lead_id}}

to fetch the paramter lead_id from the url and it works perfectly, it sends it into a rich text module.Sorry I can’t be of more help:/

Hi @Jeromecollomb,

Can you send me a link to the page in question so I can take a closer look?

Sure, here is the link to the landing page
http://get.myfeelback.com/survey-preview-query

Thanks @Derek_Gervais

Hi @Jeromecollomb,

I jumped in and checked out that page, and it looks like it’s still depending on a personalization token (i.e {{contact.company_domain}}) for the logo URL. I don’t want to edit that page on your behalf; could you try replacing the personalization token with a HubL query selection (mentioned above)?

You can also try using a HubL if statement to default to the contact personalization token in the event that the contact already exists:
designers.hubspot.com

If statements

HubL uses if statements to help define the logic of a template. The syntax of HubL if statements is very similar to conditional logic in Python. If statements are wrapped in statement delimiters, starting with an opening if statement and ending with…

Hi @Derek_Gervais thanks for taking the time to check the page.

I replaced the personalization token with the same query selection I placed a few days ago and it worked like a charm. I don’t get it, I’m guessing it was a cache issue!

Thanks a bunch Derek, you made my day!

PS: For those who are interested, the code is the following:

<img src="//logo.clearbit.com/{{request.query_dict.company_domain}}">