Knowledgebase: Form Code & Javascript
Affiliate and Customer Conversion Tracking
Posted by Kyle on 31 December 2008 03:02 PM
Cart32 is able to execute javascript after an order has been made. This is useful for clients who wish to employ various tracking systems. This article will explain how to set up tracking systems. There are a few examples of some existing tracking systems and then a generic example based on order approval status.

Quick Links:
Basic Information
Commission Junction Example
Click Trade Example
Generic Example Based On Authorization

Basic Information
Most tracking/affiliate systems use order information to track sales and conversions. All javascript code for these tracking systems should go on the confirmOrder.html template file. Here is a list of the available tags you can use in your script for the order:
  • <!SubTotal>: Total without shipping and tax
  • <!Shipping>: Shipping amount
  • <!Tax>: Tax amount
  • <!OrderTotal>: Total including shipping and tax
  • <!OrderNo>: Order number

Commission Junction Example
Commission Junction uses an image for tracking. Here is an example of how it would look:

<img src="<!SubTotal>&CID=12345&OID=<!OrderNo>&TYPE=SALE&METHOD=IMG" height="1" width="1">

Click Trade Example
Here is an example of a Click Trade tracking URL. Again it is image based and you will need to replace the <enterpriseID> and <ActionID> with the information Click Trade gives you. Here is an example:

<img src="<!SubTotal>&CID=<enterpriseID>&OID=<!OrderNo>&TYPE=<ActionID>&CURRENCY=USD&METHOD=IMG" height="1" width="1"*gt;

Generic Example Based On Authorization
It is possible to execute different javascript code blocks based on whether or not an order was approved. This is done using an if block on the confirmOrder.html template page.

Note: This section is somewhat technical in nature. If you do not understand javascript or coding you may not understand what we are doing below. If you need assistance doing this contact the Cart32 Support team and we can help you figure out what you need to do.)

The first thing we need to do is create a custom message on the confirmOrder.html template page when an order is made. This is done as follows:
  1. Log into your Cart32 Administration

  2. Navigate to the Shoppping Cart >> Order Proccessing >> Real Time Card Processing tab

  3. Change the field labeled Authorization OK Message to say whatever you want it to say, and then write it down. This is the text we will be searching the page for later to determine if the order was authorized or not.

  4. Click save

Now we need to modify the confirmOrder.html file. We need to surround the tag that displays the authorization message in a set of span tags so we can access the message contents with javascript. The tag that displays the authorization message is <!CyberCashMessage>. Here are the steps to do this:
  1. Log into your Cart32 Administration

  2. Navigate to the Appearance 2>> Template Files tab

  3. Select ConfirmOrder.html from the dropdown list

  4. Click the button labeled Load Template File

  5. Wrap the <!CyberCashMessage> tag with a span tag like this:
    <span id="cart32Message"><!CyberCashMessage></span>

  6. Click save

Finally we need to create the javascript if block to determine which action to take. To do this we will follow the same steps above to get into our Cart32 administration, but we'll be adding some javascript near the bottom of the confirm order page. Here is the code you will put after the closing body tag (</body>):
(Note: In our example we have the following text as our Authorization OK Message: Card Authorization OK)

<script type="text/javascript">
if (document.getElementById('cart32Message').innerHTML.indexOf('Card Authorization OK') > -1)
//Perform some action or submit some URL
//for tracking according to your needs
//Either do nothing or submit a different URL
//to indicate a failed authorization according
//to your tracking needs

(116 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name: