How to Run Scripts Only on the First Visit on Shopify
From the order status page that you can view, your analytics will count the sale regardless of the customers just check on their shipments. This might cause wrong analytics. Hence, to prevent them from counting inaccurate, you can learn how to run scripts only on the first visit so that your additional scripts is run only the first time your customers view their order status page.
Related Posts:
- 5 Steps to Add an Internal Note to an Order on Shopify
- How to Contact a Customer About an Order on Shopify
- How to Email the Invoice on Shopify - A Step-By-Step Guide
- How to Edit Customer Information on Shopify
How to run scripts only on the first visit
Step 1: Go to Checkout
Log in your Shopify account firstly. Click on Setting
which is at the bottom of the admin page. Then, choose Checkout
.
Step 2: Go to the Additional scripts
Scroll down to view the Order processing
section. You will see four options in it. Make sure to find out Additional scripts
which is the last.
Step 3: Run the script on order status page
Take a look at the following code. The first thing you need to do is copying the code. Afterward, paste it into the Additional scripts
text box. This code is to run the script on the order status page.
{% if first_time_accessed %}
<!-- Conversion scripts you want to run only once -->
{% endif %}
<!-- Scripts you want to run on every visit -->
Step 4: Run scripts only on the first visit
In this step, take notice of the range which you’ve pasted the code. The sentence I’ve marked with a red rectangle is the script. If you put it between the {% if first_time_accessed %}
and {% endif %}
tags, it will be run only on the first time the customers access the order status page.
Otherwise, if you put the script below the {% endif %}
tag, then, the script will be run every time the order status page is opened.
Step 5: Click Save
Finally, make sure you’ve done successfully by clicking Save
button.
To run scripts only on the first visit on Iphone (Click here)
-
Step 1: Click Setting From your Shopify app, click
Store
. Then, chooseSetting
. -
Step 2: Go to the Checkout section Make sure that you select
Checkout
in theStore setting
field. -
Step 3: Find the Additional scripts In this step, find the
Order processing
section. Then, you will see four options appeared. Find out theAdditional scripts
and click on the text box. -
Step 4: Paste the following code Make sure to copy the below code firstly. Then, you need to paste it in the
Additional scripts
text box. This action is to run a script when the order status page is accessed.{% if first_time_accessed %} <!-- Conversion scripts you want to run only once --> {% endif %} <!-- Scripts you want to run on every visit -->
-
Step 5: Decide how many time the script will be shown If you want the script to be shown only on the first time the customers access the order status page, paste it between the
{% if first_time_accessed %}
and{% endif %}
tags.Or else, a script will be shown every time the order status page is accessed by pasting it below the
{% endif %}
tag. -
Step 6: Click Save Scroll down and make sure to select
Save
after you’ve done.
To run scripts only on the first visit on Android one (Click here)
- Step 1: Click Setting
Log in your Shopify account. From the app, go to Store
. Then, choose Setting
.
- Step 2: Go to the Checkout section
Select Checkout
in the Store setting
field.
- Step 3: Find the Additional scripts
In this step, look at the Order processing
field. Four different options are displayed. Find out the Additional scripts
and click on the text box.
- Step 4: Paste the code
You’d better copy the following code in advance. In the Additional scripts
text box, paste the code you’ve copied. This code is to run the script on the order status page.
{% if first_time_accessed %}
<!-- Conversion scripts you want to run only once -->
{% endif %}
<!-- Scripts you want to run on every visit -->
- Step 5: Decide where to paste the script
In this step, take notice of the range which you’ve pasted the code. The sentence I’ve marked with a red rectangle is the script. If you put it between the {% if first_time_accessed %}
and {% endif %}
tags, it will be run only on the first time the customers access the order status page.
Otherwise, if you put the script below the {% endif %}
tag, then, the script will be run every time the order status page is opened.
- Step 6: Save
Select Save to make sure that you’ve followed this guide successfully.
Summary
Above are some simple steps you can take to run scripts only on the first visit. After following this, hope you have the accurate analytics. Check out our tutorials for Shopify store owners for more information.