Display hubspot contact first name based on a contact id in link - possible if statement?
Hi,
I'm trying to do something that I think can be done but I'm not a developer, just a marketer. I would like to create a referral landing page that displays a referrer's name based on a value in a link.
Example for someone named John:
You are a contact in hubspot and your contact id = 12345.
I send you this link to use and refer your friends website.com/refer?CID=12345.
Your friend visits the landing page, and the headline reads "Looks like you were referred by John!"
If no CID is in the link, it would display "a friend" instead.
If this possible? Can someone provide the code needed in the landing page?
Also this would ideally be scalable, and would want to avoid typing out all the contact ids for each person since there may be a thousand people with these links.
Display hubspot contact first name based on a contact id in link - possible if statement?
Hi there,
You could create a custom contact property for referrer id and then grab that ID from the URL (as you mentioned: ?CID=xxxx) with {{request.query}}, e.g. {% set id = request.query %}, then use the id to look up that contact using the Contacts API.
Then you'd need an if statement in your title like "Looks like you were referred by {% if id %}{{contact.firstname}}{% else %}a friend{% endif %}!"