# Personalization based on query string data

**URL:** <https://community.hubspot.com/t/personalization-based-on-query-string-data/11810>\
**Category:** APIs & Integrations\
**Created:** [March 20, 2018, 7:50am UTC](https://community.hubspot.com/t/personalization-based-on-query-string-data/11810 "2018-03-20T07:50:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [March 20, 2018, 7:50am UTC](https://community.hubspot.com/t/personalization-based-on-query-string-data/11810/1 "2018-03-20T07:50:56Z")

</div>

Hello!

Does anybody know how to personalize a landing page to display firstname and last name, by using query string info (?firstname=XXX&lastname=YYYY) rather than byusing existing contact properties (tokens).  
Let’s say I have a landing page at [domain.com/123](http://domain.com/123) that begins with

"Hello, "

What I want to achieve is for anyone that visits this landing page using the URL: [domain.com/123?firstname=John&lastname=Smith](http://domain.com/123?firstname=John&lastname=Smith) the first line displays “Hello John Smith,” rather than just “Hello”

I suppose it can be done using Java Script. Can anyone help with some ideas?  
 ![slightly_smiling_face.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/2/42c4d129a1c6aa74d89f3066ee8fbb15db46b3b5.png)

Thanks

---

<div class="post-metadata">

**Author:** ![Derek\_Gervais](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/derek_gervais/32/17429_2.png) [@Derek\_Gervais](https://community.hubspot.com/u/Derek_Gervais)\
**Post date:** [March 21, 2018, 6:39pm UTC](https://community.hubspot.com/t/personalization-based-on-query-string-data/11810/2 "2018-03-21T18:39:34Z")

</div>

Hi [@b.sklodowski](https://community.hubspot.com/u/b.sklodowski),

If this is on a HubSpot page, you can use the default `{{ request.query }}` and/or `{{ request.query_dict }}` HubL variables. Some more info on these variables can be found in the designer docs:

[designers.hubspot.com](https://designers.hubspot.com/docs/hubl/hubl-supported-variables#http-request-variables)

### [HubL supported variables](https://designers.hubspot.com/docs/hubl/hubl-supported-variables#http-request-variables)

HubSpot templates can use a host of predefined variables that can be used to render useful website and email elements. This page is a reference listing of those variables.

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [March 21, 2018, 8:10pm UTC](https://community.hubspot.com/t/personalization-based-on-query-string-data/11810/3 "2018-03-21T20:10:29Z")

</div>

Hi Derek, thank you for the tip! This seems to bring me a little bit closer, but when I use {{ request.query\_dict }} variable it displays the whole query string including utms and so on, so the first line looks like

Hello {firstname=John, lastname=Smith, utm\_campaign=thecampaign…}

And furthermore it is all inside the { } brackets. Any ideas how to improve it ?  
 ![slightly_smiling_face.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/2/42c4d129a1c6aa74d89f3066ee8fbb15db46b3b5.png)

---

<div class="post-metadata">

**Author:** ![Derek\_Gervais](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/derek_gervais/32/17429_2.png) [@Derek\_Gervais](https://community.hubspot.com/u/Derek_Gervais)\
**Post date:** [March 23, 2018, 5:36pm UTC](https://community.hubspot.com/t/personalization-based-on-query-string-data/11810/4 "2018-03-23T17:36:01Z")

</div>

Hi [@b.sklodowski](https://community.hubspot.com/u/b.sklodowski),

That particular variable is a dictionary, so you should be able to select specific fields using dot notation:

`{{ request.query_dict.firstname }}`

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [August 17, 2018, 2:19pm UTC](https://community.hubspot.com/t/personalization-based-on-query-string-data/11810/5 "2018-08-17T14:19:56Z")

</div>

Hey Derek - I was referred here by Hubspot chat support. I am trying to use a query string in the link of my Hubspot hosted landing page to populate the contact’s first name into the landing page header. My example is very similar to what is listed above but I do not understand how to create the custom query string so that it pulls the appropriate name. Can you help?

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [March 23, 2018, 5:50pm UTC](https://community.hubspot.com/t/personalization-based-on-query-string-data/11810/6 "2018-03-23T17:50:54Z")

</div>

Thank you very much! This works 100%

---

<div class="post-metadata">

**Author:** ![Derek\_Gervais](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/derek_gervais/32/17429_2.png) [@Derek\_Gervais](https://community.hubspot.com/u/Derek_Gervais)\
**Post date:** [August 22, 2018, 8:28pm UTC](https://community.hubspot.com/t/personalization-based-on-query-string-data/11810/7 "2018-08-22T20:28:07Z")

</div>

Hi [@kaitmaag](https://community.hubspot.com/u/kaitmaag),

Query string parameters are simple key/value pairs added to the end of a URL, like this:

`https://www.example.com/stuff?firstname=Derek`

In this example, the key is `firstname` and the value is `Derek`. The aforementioned code snippet:

`{{ request.query_dict.firstname }}`

Would be replaced by `Derek` on a landing page. Does that answer your question?
