paxxxtothemax / substruct

Automatically exported from code.google.com/p/substruct
0 stars 0 forks source link

Enabling Google E-Commerce Reporting in the shopping cart #188

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
How can I enable the Google e-commerce reporting the shopping cart so I 
can monitor the transaction through my web site using the substruct CRM 
tool.

To do this I need to know the codes/numbers for these variables

Order ID
Affiliation
Total
Tax
Shipping
City
State
Country
Order ID
SKU
Product Name 
Category
Price
Quantity

Does anyone know that so I can add the correct code/number for each 
variable in the final page for the cart.

The code that Google wants people to set up it this.

<script type="text/javascript">
var gaJsHost = (("https:" == 
document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-
analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
} catch(err) {} </script> 
Next, somewhere in the receipt below the tracking code, call the _addTrans
() and _addItem() functions. Begin with a call to _addTrans() to establish 
a transaction. _addTrans() takes the following arguments: Order 
ID,Affiliation, Total, Tax, Shipping, City, State, Country. For each item 
that the visitor purchases, call _addItem(). _addItem() takes the 
following arguments: Order ID, SKU or Code, Product Name, Category, Price, 
Quantity. 
Here is a complete example:
<script type="text/javascript">
var gaJsHost = (("https:" == 
document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-
analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

</script>
<script type="text/javascript">
try {
  var pageTracker = _gat._getTracker("UA-XXXXX-1");
  pageTracker._trackPageview();
  pageTracker._addTrans(
    "1234",                                     // Order ID
    "Mountain View",                            // Affiliation
    "18.28",                                    // Total
    "1.29",                                     // Tax
    "5",                                        // Shipping
    "San Jose",                                 // City
    "California",                               // State
    "USA"                                       // Country
  );
  pageTracker._addItem(
    "1234",                                     // Order ID
    "DD44",                                     // SKU
    "T-Shirt",                                  // Product Name 
    "Green Medium",                             // Category
    "11.99",                                    // Price
    "1"                                         // Quantity
  );
  pageTracker._trackTrans();
} catch(err) {}</script>

Can anyone help me with this??

Original issue reported on code.google.com by dagurjon...@gmail.com on 21 Nov 2009 at 6:59