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 and shop Liquid objects. To learn more about their attributes, refer to The checkout object and The shop object.

  • Tracking scripts - You can add tracking scripts to track referrals, return on investment, or conversions.

Example customizations using additional scripts

Here are some example customizations that use the Additional scripts field:

Access the additional scripts

To access additional scripts, start from your Shopify admin, and go to Settings > Checkout. Under Order status page you find the Additional scripts section.

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.

Steps:

  1. From your Shopify admin, go to Settings > Checkout.
  2. In the Order status page section, go to the Additional scripts text box.
  3. Paste the following code into the Additional scripts box:
{% if first_time_accessed %}
  // Conversion scripts you want to run only once
{% endif %}

  // Scripts you want to run on every visit
  1. If you want a script to run the first time that the order status page is accessed, then paste it between the {% if first_time_accessed %} and {% endif %} tags. If you want a script to run every time the order status page is accessed, then paste it below the {% endif %} tag.
  2. Click Save.

Ready to start selling with Shopify?Try it free