1

I have functionality on a cloud page that depends on the cloud page url. I know how to Requestparameter(), but how do I get the entire url using ampscript or SSJS?

  • You mean the current cloud page URL? – codeyinthecloud Dec 18 '18 at 18:02
  • Yes, like "subdomain.site.com" or what ever url one would use to access the page: Had it been "subdomain.site.com?value=yes" I could use RequestParameter("value") to get the query string. But how do I get the complete url? The idea is to use the same code on multiple landing pages. – Tove Dec 18 '18 at 19:11
3

You can get the current page url in amp script by using RequestParameter('PageURL'). This gives you the url dynamically without you having to hardcode.

Reference: Look at How to Fetch a html form's Post variables using AMPSCRIPT and create a record with the values in salesforce objects specifially @Eliot's answer He is using the below snippet to submit the form to the current page.

<form action="%%=RequestParameter('PAGEURL')=%%" method="post">

You can try debugging your currentURL in the page using inline variables like below.

<h1>%%=RequestParameter('PAGEURL')=%%</h1>
  • Ohh yes!! I totally had forgotten about this one. It does the trick. Thanks so much! – Tove Dec 18 '18 at 19:37
  • @Tove You're welcome. Glad to help! – codeyinthecloud Dec 18 '18 at 19:40

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.