I have a query string on a thank you page like this:


On this thank you page, there's a CTA button, (from the standard hero item). This button links to another page and I would like the querystring from the URL (name and value) to the link in the CTA.

So the link should look like this when setting it up:


And when you get to the TY page, if this querystring is in the URL it should add the querystring so the CTA link is:


Picture below for clarification on where the query string is entered.

  • You can do code to read querystring from URL and merge query string in CTA URL Aug 17, 2019 at 9:01

2 Answers 2


It will go in Query String field. In order to fetch it you need to write something like this


@using (Html.Glass().BeginRenderLink(navItem, x => x.Link, new { @class = cssClass })) { @Html.Glass().Editable(navItem, x => x.Title); }



for more refer below link: Glass mapper BeginRenderLink stripping query string parameter that is a Url with ga parameters


In the component where you have the CTA button write the code as:

In c#

string key = "querystring";
  if (!string.IsNullOrEmpty(Request.QueryString[key]))
      <a href="@string.Format("http://domain.com/{0}={1}", "?" + key, Request.QueryString[key])">GO to page2</a>
      <a href="http://domain.com" >GO to page2</a>

If you want to handle it with jQuery then:

  1. get the query string value using jQuery ( you can do it as suggested here: https://stackoverflow.com/questions/4656843/jquery-get-querystring-from-url)

  2. Check if the query string value is not null, empty or undefined.

  3. Provide id or class on your CTA link, so that bu the reference of id or class CTA's href attribute can be filled with the complete page url + query string value retrieved in step-1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.