Adding additional scripts and running scripts only on first visit
You can customize your order status page by adding additional scripts. You can also set up your scripts to run only on a first visit.
Add additional scripts
The Additional scripts box is used to insert code into the template for your order status page. You can add any of the following:
HTML - You can use any valid HTML5 code, for example script, style, iframe, and object elements.
Liquid code - You have access to the
checkout
andshop
Liquid objects. To learn more about their attributes, refer to The checkout object and The shop object. Note that thecheckout.order
,checkout.order_name
, andcheckout.order_number
values may not be present if the order creation is not yet complete. Use `checkout.order_id if you need a unique tracking id for the order that is available at all times.
Example customizations using additional scripts
Here are some example customizations that use the Additional scripts field:
- Show content when a particular shipping method is used
- Show content when a particular product is in the order
- Show content based on customers' locations
- Add a message to your order status page using a JavaScript object
Access the additional scripts
Set up scripts to run only on a first visit
It's common to include scripts that track sales conversions on the order status page because it's the final page of checkout. However, customers who return to check their order status might count as a second sale in your analytics.
To prevent your analytics from counting customers more than once, you can add the first_time_accessed
property around some or all of your additional scripts. To do this, use a Liquid if statement, and place any scripts that you only want to run once between {% if first_time_accessed %}
and {% endif %}
tags.