Jump to content


Circle Member
  • Posts

  • Joined

  • Last visited

Everything posted by vektren

  1. For anyone who wants to do this, I got it to work on 7.0 and 7.1. You can pass any number of URL parameters, and the script allows you to push them into a code block: The URL I used for this: https://website.com/ordered?firstname=Jack&order=2545346&email=jack@email.com Log in to your Squarespace account and navigate to the page where you want to display the URL parameters as payload. Click on the page's settings icon and select "Advanced" from the menu. Click on "Code Injection" in the Advanced menu. In the "Header" section of the Code Injection panel, paste the following code: <script> window.onload = function() { const urlParams = new URLSearchParams(window.location.search); const firstName = urlParams.get('firstname'); const order = urlParams.get('order'); const email = urlParams.get('email'); const payloadString = `Thank you, ${firstName}<br/> Here is yout order number: ${order}<br/> And lastly, we will send order updates to the following email address on file: ${email}`; document.getElementById('url-payload').innerHTML = payloadString; } </script> Then on the page, you want to display the payload: In the page editor, add a "Text" block where you want to display the URL payload. In the text block, add the following code: <h1>Your order has been submitted</h1> <p id="url-payload"></p> You can add/change the number of parameters by adding and removing "const parameter = urlParams.get('parameter');" within the Java Script above, and then add it to your payload under PayloadString: by adding ${parameter}. Thanks to everyone that put me on the right path!
  2. Hey, is this still working on 7.1? I just cannot seem to get it working. Added the code in <script></script> tags under the advanced section for the page itself, not site-wide. I got the block-id's correctly from inspecting the page. I have added some text to the block for it to load, but nothing is replaced? Are their variables that I need to add to the page? Or is the script (from my understanding) replacing current text in format <h3> etc... ? I am redirecting users from Typeform, with their names, email, and order details in the URL, and just want them to have a personalised order confirmation screen.
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.