Menu Close

Get Support From ShopWired Close

All systems operational

Subscribe To Updates
Prefer To Live Chat? Chat directly with ShopWired support Available from 9.00am to 10.00pm Monday to Friday Quickest response time
Send A Message
Response within 24 hours

Menu Close

Menu

Visitor and conversion tracking

Tracking your visitors and monitoring their behaviour on your website can help you discover the strong and weak points of your website, so you can determine which areas need changing in order to increase conversions and sales.

There are two types of visitor tracking:

  1. Visitor tracking that tracks visitors to all of your website pages.
  2. Conversion tracking which tracks when visitors make a purchase on your website.

Both visitor tracking and conversion tracking can be set up by selecting Settings > Visitor Monitoring > Visitor Tracking from the menu.

• Getting visitor tracking
• Setting up visitor tracking
• What is conversion tracking?
• Setting up conversion tracking
• Google Ecommerce tracking
• Adding dynamic content (Twig variables)


Getting visitor tracking

The ShopWired platform can provide you with basic visitor statistics through the ‘Visitor Statistics’ report, but it is strongly recommended that you set up a tracking provider for more detailed and advanced visitor monitoring. You won’t need to place code snippets onto your individual website pages as the code can be entered in one place on the management system, and the platform will then automatically place the code where it needs to be.

There are many companies offering visitor tracking that you can use, but we recommend you use Google Analytics, which is a free tool provided by Google. To use Google Analytics on your website you first need to create an analytics account. Click here to learn how to set up Google Analytics.


Setting up visitor tracking

To begin using the tracking system that you have chosen you will need to obtain the tracking code from your provider. Then, on your visitor tracking page in your ShopWired account, paste the code into the ‘Visitor Tracking Code’ box:

Make sure you have copied the code exactly as it is provided to you.

Once you have entered the code select save changes. You should then be able to see your visitor statistics in your account with your provider within 24 hours.


What is conversion tracking?

A conversion occurs when a visitor accesses your website from an advertising medium and then purchases a product from you. For example, if you were advertising on Google Adwords and somebody clicked on one of your adverts and then made a purchase that would be a conversion.

Conversion tracking is used to track and analyse these conversions. You should use conversion tracking to help you determine which of the marketing methods that you use are producing results and which aren’t. You can analyse each advert/keyword that you use to help you narrow down which methods work best for your store.


Setting up conversion tracking

Any provider you choose to use for your conversion tracking will provide you with ‘conversion code’ which is a small piece of computer code that needs to be placed on the ‘checkout success’ page of your website. This is the page that is shown to a customer when they successfully place and pay for an order. The code, however, won’t be able to be seen by the customers; it’s set so your provider can record that the customer made a purchase.

Once you have your conversion code enter it on the visitor tracking page in your ShopWired account, and the system will automatically place it on the appropriate page of your website. On your visitor tracking page place the code in the ‘Conversion Code’ box:

Make sure you have copied the code exactly as it is provided to you.

Once you have entered the code select save changes.


Google Ecommerce tracking

Google Analytics offers a tool called ‘Ecommerce Tracking’ which allows you to track your ecommerce data and see your orders in your Google Analytics account. More information about how the tracking works can be found here on Google’s website.

To install the ecommerce tracking on your account you will first need to make sure that you are using the ‘Universal Analytics’ feature of Google Analytics. Click here to learn how to set up Universal Analytics when creating your Google Analytics account.

Once you are using Universal Analytics enter your Google Analytics ID into the field on the visitor tracking page in your ShopWired account:

Your ID can be found in your Google Analytics account and will begin with the letters UA.

Once you have entered your ID select save changes.


Adding dynamic content (Twig variables)

Beneath each of the 3 script fields on the visitor tracking page you'll notice a tick box that you can select if you want to add dynamic content to your scripts.

Dynamic content can be used to send additional information to your script provider (such as an order reference or the order total to a conversion tracking script).

Simply tick the tick box and add the dynamic content within your script (some use cases and examples are shown below). You must use the |escape('js') filter on any Twig variable that you include, failure to do so could lead to security vulnerabilities on your website.


Visitor tracking

The visitor tracking code field has access to some custom variables for you to send details about a website visitor. These are included in a special data Twig object that is only available from this field.

data.currency_id returns the ID of the currency selected by the visitor (similar to the global.currency_id variable.

data.current_path returns the path of the page the visitor is viewing.

data.basket.value returns the total (currency) value of products in the visitor's shopping basket.

data.basket.items returns the total number of items in the visitor's shopping basket.

data.wishlist.items returns the total number of items in the visitor's wishlist.

data.basket gives access to the basket object.

data.customer gives access to the customer object.

An example implementation where the SKU codes of items in the basket is sent in a tracking script is shown below. This script is coded to only trigger when the visitor views the shopping basket page.

The Live chat script field has the same access to dynamic content as the visitor tracking code field.


Conversion tracking

The contents of the conversion tracking field only outputs on the checkout/complete page of your website, so only sends data when an order is placed successfully (including offline payment orders).

The field only has access to the order object which includes the order product object.

An example implementation where the field is being used to send order data to Affiliate Window is shown below.

A typical use of the conversion tracking field is to send order data through to Google Analytics if using GA4.

In this case, you can copy and paste the code below into the conversion tracking field.

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
	window.dataLayer = window.dataLayer || [];
	function gtag(){dataLayer.push(arguments);}
	gtag('js', new Date());
	gtag('config', 'G-XXXXXXXXXX');
	gtag('event', 'purchase', {
	transaction_id: "{{ order.reference|escape('js') }}",  
	value: {{ order.total|escape('js') }},
	currency: "XXX",	
	tax: {{ order.vat|escape('js') }},	
	shipping: {{ order.shipping_total|escape('js') }},  
	items: [
	{% for product in order.products %}{
		item_id: "{{ product.sku|escape('js') }}",  
		item_name: "{{ product.name|escape('js') }}",
		currency: "XXX", 
		price: {{ product.total|escape('js') }}
	}{% if loop.last %}{% else %},{% endif %}
	{% endfor %}
	]
});
</script>

The screenshot below shows the code in place within ShopWired.

Important: There are two parts of the code above that need to be replaced with the value relating to your Google Analytics account.

Replace both instances of the text G-XXXXXXXXXX with your own Google Analytics ID.

Replace both currency values XXX with the currency code for your website, e.g. USD, GBP or EUR.