So I've been trying to fix this issue ever since I landed this job a couple weeks back. They have had Google Analytics accounts but they never installed e-commerce conversion tracking. If you aren't familiar with GA E-Commerce tracking, this is NOT the regular traffic tracking code, nor is it simply a question of setting up a Conversion Goal in the account. This is a completely different JavaScript code, and a much more complicated one, especially if you don't know JavaScript like me. It's not just a simple copy and paste because this script relies on pulling the values of a series of variables that are defined by your e-commerce shopping cart platform, and every platform defines these variables differently. I've got the code to the point where it IS reporting data to the account successfully, but the data it is reporting is completely incorrect and in some cases is reporting the variable name itself rather than the value of the variable. Unfortunately I will grow a third nut before I convince my employers to use a different CMS, so I have to work with what I got. This is what my CMS support knowledge base has to say on the issue and it details the variables here:
I'm pretty sure at this point it has to be something wrong with the script itself, but it is beyond my knowledge of JS. My placement of it within the CMS isn't the problem, I've triple checked it and I have other scripts in the same field that are working perfectly. Any help any JS Pro's can provide would be greatly appreciated.
A sample script can be found by Googling the phraseIn most cases, your ROI tracking service will provide some form of scripts (generally JavaScript) for you to include in your site. However, there are some advanced functions that will allow you to create your own custom JavaScript for the purpose of customized ROI tracking integration.The following notes on creating tracking scripts are intended for advanced users familiar with ROI tracking systems and JavaScript programming.Please note that Volusion supports HTML, CSS, JavaScript, and ASP web code (where available). PHP and other scripting languages are not supported.Where Order-Specific Information is GeneratedOrder-specific information can be generated by JavaScript on the OrderFinished.asp page within Volusion. Two JavaScript arrays will be initialized that you may need to be aware of:Order Array ContentsOrder[0] = Order IDOrder[1] = UnusedOrder[2] = Payment AmountOrder[3] = Affiliate Commissionable ValueOrder[4] = Sales TaxOrder[5] = Total Shipping CostOrder[6] = Billing CityOrder[7] = Billing StateOrder[8] = Billing CountryOrder[9] = Email AddressOrderDetails Array ContentsOrderDetails[X][0] = Order IDOrderDetails[X][1] = Order Detail IDOrderDetails[X][2] = Product CodeOrderDetails[X][3] = Product NameOrderDetails[X][4] = Category IDOrderDetails[X][5] = Product PriceOrderDetails[X][6] = Quantity Note that in the above example, [X] refers to an OrderDetail line item number (beginning from zero). There may be multiple OrderDetails arrays - one for each unique item contained within an order.
selecting the first search result listed, and scrolling to the bottom of that page and clicking on the Traditional Syntax bullet. Sorry, I don't have permission to post links yet.This is a copy of the code as I placed it in my order confirmation page, with my GA UA# edited out and anything that BHW might pick up as a URL slightly edited:google analytics google developers ecommerce tracking
Code:
<script type="text/javascript">
var gaJsHost = (("htpps:" == document.location.protocol ) ? "htpps://ssl." : "htpp://ww.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analyticscom/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-BLACKHATWORLD-1");
pageTracker._trackPageview();
pageTracker._addTrans(
"Order[0]", // order ID - required
"Allforfloors.com", // affiliation or store name
"Order[2]", // total - required
"Order[4]", // tax
"Order[5]", // shipping
"Order[6]", // city
"Order[7]", // state or province
"Order[8]" // country
);
// add item might be called for every item in the shopping cart
// where your ecommerce engine loops through each item in the cart and
// prints out _addItem for each
pageTracker._addItem(
"OrderDetails[X][0]", // order ID - necessary to associate item with transaction
"OrderDetails[X][2]", // SKU/code - required
"OrderDetails[X][3]", // product name
"OrderDetails[X][4]", // category or variation
"OrderDetails[X][5]", // unit price - required
"OrderDetails[X][6]" // quantity - required
);
pageTracker._trackTrans(); //submits transaction to the Analytics servers
} catch(err) {}
</script>
I'm pretty sure at this point it has to be something wrong with the script itself, but it is beyond my knowledge of JS. My placement of it within the CMS isn't the problem, I've triple checked it and I have other scripts in the same field that are working perfectly. Any help any JS Pro's can provide would be greatly appreciated.
Last edited: