Here's how to get the URL of current page (with parameters) in SSJS:

var url = Platform.Request.RequestURL();

Effectively, it's the equivalent of RequestParameter('PAGEURL') in AMPscript.

However, this only provides the base url, without the query parameters. Hence if placed in a Cloud Page which is called: https://cloud.e.example.com/whatever?foo=bar&john=doe, I only receive https://cloud.e.example.com/whatever in each of these functions. Is there a way of receiving the complete URL with all request parameters?


This code is used in a code resource, which is called with a set of request parameters. One of which is a URL (which is sent as PageUrl request parameter), telling which page has called the code resource.

The odd behaviour is, that Platform.Request.RequestURL(); is returning the correct full URL with all request parameters, UNLESS one of these parameters contains a URL of it's own. In this case, only the URL in the parameter gets returned by Platform.Request.RequestURL();. And yes, I did verify this is not related to a single variable in SSJS getting overwritten with the URL from that particular request parameter.

Any suggestions for an alternative solution?

  • Not sure how your Cloud Page was called since the first method should show a full URL. I also did test it myself and got a full URL.
    – Duc Le
    Commented Nov 27, 2023 at 13:16
  • Thanks for checking this, @DucLe. I did some more tests based on your feedback, and discovered some interesting quirk of the RequestURL() function. Please see my updated question. Commented Nov 27, 2023 at 13:31
  • Indeed, if one of the parameters contains a URL, it does not function correctly. Do you have the possibility to combine two different functions instead of RequestURL? If yes, then you can use ReferrerURL to get the base URL, and QueryString to get the query string (and it does return all the query strings including the additional URL), and then concatenate these two strings.. Commented Nov 27, 2023 at 14:12
  • @RachidMamai QueryString is AFAIK not possible to fetch in it's complete form in a single function. One will need to go one parameter at a time, e.g. Request.GetQueryStringParameter("foo"); - or am I missing out on a function? Commented Nov 27, 2023 at 14:21
  • 1
    Actually, QueryString is a function that returns the full query string. I've tested it personally and it returns the full list of parameters as a string. No need to fetch the parameters one by one using GetQueryStringParameter.. Commented Nov 27, 2023 at 14:27

1 Answer 1


I'm moving my comment here as you asked.

You can combine the use of two functions:

  • ReferrerURL to get the base referrer's URL
  • QueryString to get the full query string (and yes it works even if one of the parameters contains a URL)

Then, concatenate both strings.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .