Skip to content
  • There are no suggestions because the search field is empty.

How to Add a Tracking Code to the Order Completion Page [Migration Draft]

Where to place the code


In many cases, such as when integrating with Internet advertising systems like Google AdWords or an external affiliate tracking program, you might need to add tracking code to the “Order Completion” page in your storefront.

A page has been created that is dedicated to hosting tracking code. The page is called orderCompleteTracking.asp and is located in the pc folder. Open the page in Notepad or your favorite HTML editor. You will see the following code.
 
<%

pOrderNumber = (int(pOID)+scpre)

'// HOW TO USE THIS PAGE
'// 1.) This file can help you add custom tracking code
'// 2.) The file is included at the bottom of orderComplete.asp, home.asp, and viewPrd.asp.
'// 3.) There are two sections in this page "TRACKING" and "LANDING": see below

	IF pcv_intOrderComplete=1 THEN	
	
		'////////////////////////////////////////////////////////////////////////////////////////
		'// TRACKING: enter below any code to TRACK the successful completion of an order
		'////////////////////////////////////////////////////////////////////////////////////////

		' Advanced users: you can use any of the following variables in your tracking code:
		' pOID:  This variable holds the order number from the ProductCart database
		' pOrderNumber: The order number shown to customer
		' ptotal: The order total amount
		' pOrderStatus: An integer representing the status of the order
		
		' ENTER your tracking code BELOW the ASP tag located on the next line.
		%>
		
		<%

	ELSE

		'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		'// LANDING: enter below any code to track a customer's LANDING on the hone page
		'// or product details page
		'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

		' ENTER your tracking code BELOW the ASP tag located on the next line.
		%>	
		
		<%

	END IF
%>
As you can see, the page is divided into two sections, one for hosting tracking code to be used when you are tracking the completion of an order, and another for hosting code that tracks a customer's visit to your store.

The page is heavily commented. Follow the comments on the page. All tracking code must be placed between the ASP tags.
 
%>
 Your tracking code goes here, between the closing and opening ASP code tags.
<%

See below for more information about how to use order-related variables in your tracking code (e.g. to “pass” the order total to the tracking system).
 

Order-related variables


Many tracking scripts will allow you to pass order-related variables to the third-party system that you are integrating your store with. Here are some of the variables that you can use.
  • Order ID = pIdOrder
  • Order total = ptotal
  • Customer ID = pidCustomer
  • Product SKU = pcs_ShowSKU (the variable used by this method is 'pSku')
In ASP, to write a variable to the page (and therefore also add it to your custom script), you will use the following code (e.g. for the order ID):
<%=pIdOrder%>

 

Example: Google AdWords


For example, the standard Google AdWords tracking code would look as follows:
<!-- Google Code for Purchase Conversion Page --> 
<script language="JavaScript" type="text/javascript"> 
<!-- var google_conversion_id = 1234567890; 
var google_conversion_language = "en_US"; 
var google_conversion_format = "1"; 
var google_conversion_color = "666666"; if (<%=pTotal%>) { 
var google_conversion_value = <%=pTotal%>; 
} 
var google_conversion_label = "Purchase"; 
//--> </script> 
<script language="JavaScript" 
src="http://www.googleadservices.com/pagead/conversion.js"> 
</script> 
<noscript> 
<img height=1 width=1 border=0 
src="http://www.googleadservices.com/pagead/conversion/1234567890/?value=<%=pTotal%>&label=Purchase&script=0"> 
</noscript>
  • Order total variable
    Note that the “pTotal” variable is written to the script 3 times.
  • Secure and non-secure pages
    Since your checkout is probably using the HTTPS protocol (SSL certificate), you should request the HTTPS (secure) version of the tracking code from your Google AdWords account.
  • Google AdWords and Google Analytics
    You can have both Google AdWords and Google Analytics tracking on the same store. They work independently of each other in terms of the tracking of the completion of an order.

Adding the Facebook Pixel to your Store

If you are looking to add The Facebook Pixel to your store as described here:

https://www.facebook.com/business/help/952192354843755

...Please refer to the following ProductCart Help Desk Article:

https://productcart.desk.com/customer/portal/articles/2879039-adding-the-facebook-pixel-to-your-store