Difference between revisions of "Tracking Order Amounts: Advanced"

From Market Ruler Help
Jump to: navigation, search
 
Line 11: Line 11:
  
 
<code>
 
<code>
var cramount = ''''ORDER_AMOUNT'''';<br />
+
var  
var crtext = ''''ORDER_NUMBER'''';<br />
+
cramount = ''''ORDER_AMOUNT'''',<br />
cr_track('3');<br />
+
crtext = ''''ORDER_NUMBER'''';<br />
 +
__CR.track('3');<br />
 
</code>
 
</code>
  
Line 24: Line 25:
  
 
<code>
 
<code>
var cramount = ''''<%= oRS("subtotal") %>'''';<br />
+
var  
var crtext = ''''<%= oRS("order_id") %>'''';<br />
+
cramount = ''''<%= oRS("subtotal") %>'''',<br />
cr_track('3');<br />
+
crtext = ''''<%= oRS("order_id") %>'''';<br />
 +
__CR.track('3');<br />
 
</code>
 
</code>
  
Line 33: Line 35:
  
 
<code>
 
<code>
var cramount = ''''<?= $order['subtotal'] ?>'''';<br />
+
var  
var crtext = ''''<?= $order['id'] ?>'''';<br />
+
cramount = ''''<?= $order['subtotal'] ?>'''',<br />
cr_track('3');<br />
+
crtext = ''''<?= $order['id'] ?>'''';<br />
 +
__CR.track('3');<br />
 
</code>
 
</code>
  
Line 41: Line 44:
  
 
<code>
 
<code>
var cramount = '199.99';<br />
+
var  
var crtext = '2369';<br />
+
cramount = '199.99',<br />
cr_track('3');<br />
+
crtext = '2369';<br />
 +
__CR.track('3');<br />
 
</code>
 
</code>
  
Line 51: Line 55:
  
 
<code>
 
<code>
var cramount = CAOrderSubTotal;<br />
+
var  
var crtext = CAOrderID;<br />
+
cramount = CAOrderSubTotal,<br />
cr_track('3');<br />
+
crtext = CAOrderID;<br />
 +
__CR.track('3');<br />
 
</code>
 
</code>
  
Line 60: Line 65:
 
<code>
 
<code>
 
var cramount = '199.99';<br />
 
var cramount = '199.99';<br />
cr_track('3');<br />
+
__CR.track('3');<br />
 
</code>
 
</code>
  
Line 75: Line 80:
 
var crtext2 = "2009-05-30 44:33:22";<br />
 
var crtext2 = "2009-05-30 44:33:22";<br />
 
var crtext3 = "affiliate5434";<br />
 
var crtext3 = "affiliate5434";<br />
cr_track('3');<br />
+
__CR.track('3');<br />
 
</code>
 
</code>
  
Line 89: Line 94:
 
var cramount = "USD $33.55";<br />
 
var cramount = "USD $33.55";<br />
 
var cramount0 = "USD $330000324.55";<br />
 
var cramount0 = "USD $330000324.55";<br />
cr_track('3'); // Records $33.55 only<br />
+
__CR.track('3'); // Records $33.55 only<br />
 
</code>
 
</code>
  
Line 99: Line 104:
 
* [[Commerce Tracking]]
 
* [[Commerce Tracking]]
 
* [[JavaScript]]
 
* [[JavaScript]]
 +
* [[cr_track|__CR.track]]
  
 
[[Category:ConversionRuler]]
 
[[Category:ConversionRuler]]
 
[[Category:ConversionRuler Installation]]
 
[[Category:ConversionRuler Installation]]
 
[[Category:Technical]]
 
[[Category:Technical]]

Latest revision as of 15:22, 26 February 2016

How to set up ConversionRuler Commerce Tracking snippets.

To pass financial information to our servers you will need to modify the “order snippet”. This will generally require some coding in the technology that your shopping cart uses.

The Tracking Snippet page allows you edit your snippet to add values you have configured.

Technical Documentation

The tracking snippet needs to be modified with the values for the orders that you might track. Two JavaScript variables are recognized by ConversionRuler.

The basic change you need to make is filling in the ORDER_AMOUNT and ORDER_NUMBER values:

var cramount = 'ORDER_AMOUNT',
crtext = 'ORDER_NUMBER';
__CR.track('3');

Because "cramount" and "crtext" are Javascript values, they can be defined anywhere on the page prior to invoking our snippet.

It is best to quote them with single quotes to avoid JavaScript errors.

Microsoft Active Server Pages Example

For example, if you are using Microsoft Active Server Pages, your snippet may look like this:

var cramount = '<%= oRS("subtotal") %>',
crtext = '<%= oRS("order_id") %>';
__CR.track('3');

PHP Example

If you are using PHP in your server, you snippet may appear like this:

var cramount = '<?= $order['subtotal'] ?>',
crtext = '<?= $order['id'] ?>';
__CR.track('3');

When your pages generate, the final page should look like this for an order of $199.99 with order number 2369:

var cramount = '199.99',
crtext = '2369';
__CR.track('3');

JavaScript-only Example

Some shopping carts actually generate JavaScript variables with the order amount and order number in them already on the page, in which case no quoting is required:

var cramount = CAOrderSubTotal,
crtext = CAOrderID;
__CR.track('3');

All variables are optional, so to just include the order amount:

var cramount = '199.99';
__CR.track('3');

Comprehensive Example

And, as a final example, you can pass up to four different amounts and strings with each action:

var cramount0 = "USD $33.55";
var cramount1 = "$5.34";
var cramount2 = "$2.33";
var cramount3 = "$512.23";
var crtext0 = "ORD1850-6923942639234";
var crtext1 = "john-doe@example.com";
var crtext2 = "2009-05-30 44:33:22";
var crtext3 = "affiliate5434";
__CR.track('3');

Special characters

Order amounts may include special characters such as $ or € - our servers will strip away all of the non-numerical information.

Using different variables which mean the same thing

Note that the JavaScript variables "cramount" and "cramount0" are analogous, as are "crtext" and "crtext0".

If, for some reason, you define cramount and cramount0 on your page, then cramount will be recorded, and cramount0 is not recorded.

var cramount = "USD $33.55";
var cramount0 = "USD $330000324.55";
__CR.track('3'); // Records $33.55 only

For more help

We have installed order tracking in hundreds of shopping carts so if you are stuck, feel free to contact us!

Related