Add markup to a Squarespace Order Status page only if it is the first view
Squarespace killed the Order Confirmation page (RIP) and replaced it with the Order Status page. So now the customer immediately sees the Order Status page after completing checkout. The same Order Status page they see if they click the View your Order button in the order email notification.
This created a problem in that there were some things a site owner would only want to happen one time, immediately after the customer made the purchase. For example: tracking the sale through an analytics service.
It appears there may be a way to do this, with a bit of code that I can't seem to find anywhere else online at the moment. Try putting this into Settings > Advanced > Code Injection > Order Status Page:
That conditional statement means that the customer will only be served the markup the first time they view the Order Status page for this particular order. Put whatever markup/scripts/etc in there that you only want to fire once, as if it were on the old Order Confirmation page.
In some basic testing this appears to work as described. Give it a try if you have the need.
Have a question or comment about this post, or just want to say hi? Drop me a line
Earlier Post: A New Battery
Later Post: Show All Posts from All Blogs in Chronological Order in a Shopify Liquid template