We want to create a Cloud Page that dynamically changes content in the page according to a URL parameter. Users will visit the page directly, we won't send them to the page from email.

What I did:

Created DealerDE with some data:

1 |Joe |1234
2 |Dan |5678

Created cloud page and used the Lookup function successfully manually, %%=Lookup('DealerDE','Name','ID',1)=%%

Output: My name is Joe and my phone is 1234

My question:

I want that according to the URL parameter example.com/?id=2 the page will show the Name and the Phone from the DE: My name is Dan and my phone is 5678
What needs to be done i Lookup query to make it happen?

1 Answer 1


There are two functions in AMPscript that let you retrieve the parameters sent by the request message.

  1. QueryParameter - Only usable for GET-parameters (suitable for your use case)
  2. RequestParameter - Usable for GET- and POST-parameters (also suitable for your use case)

So your code would look like this:

%%=Lookup('DealerDE','Name','ID', RequestParameter('id'))=%%

Related documentation:

  • Thank you! Follow up question: if this parameter doesn't exist in the URL, can I show default value? instead of example.com/?id=1 the user entered example.com/
    – MaorU
    Sep 16, 2019 at 7:12
  • For that use case you need to use IF-statements. I suggest reading the ampscript syntax guide which shows how to do so. Sep 16, 2019 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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