How do you track adsense revenue through Google analytics?

1shoppingcart: How to setup Google Analytics E-commerce tracking for 1Shopping Cart?

  • Is there any way to track revenue and other post-transaction variables in Google Analytics for http://1shoopingcart.com? The support guy said that it's not possible for system hosted receipt page. I know it's not true. Has anyone ever done it? Any suggestions or code will be helpful.

  • Answer:

    If you're running a system hosted Thank You page inside 1ShoppingCart, take a look at the source of the page.  There should be an automatically generated insert of JavaScript code.  In that code, a new global JavaScript object is created:  SecureCartOrders. For each order on the Thank You page, there will be an entry inside of this variable with the details from the order.  Most Thank You pages will result in just one order, so you'll most likely see only one entry, accessible via SecureCartOrders[0]. Inside that variable is a wealth of information on the order and products.  It is the same information that is submitted to a third-party Thank You page via a POST command. Each product in the order is accessible via an incremented key across that root variable.  So, while SecureCartOrders[0].orderID is available, so is SecureCartOrders[0].sku[key] which will return the sku of the <key> product in the order. Take jQuery's each function into consideration and you can map your transaction records like something below.  Hint:  The fields in Home -> Setup -> Third-Party Integrations in the 1SC admin panel allow for a plethora of JavaScript.  With jQuery and a little knowledge, you can do anything. jQuery.each(SecureCartOrders[0].product, function (key, value) {   _gaq.push( ['_addItem',   SecureCartOrders[0].orderID, // Order ID   SecureCartOrders[0].sku[key], // SKU   SecureCartOrders[0].product[key], // Product Name   '', // Category   ((SecureCartOrders[0].price[key] / agg_quantity) - (SecureCartOrders[0].discount / agg_quantity)).toFixed(2), // Price   SecureCartOrders[0].quantity[key] // Quantity   ]); }); Refer to the definition of the root object and Google Analytics transaction processes to get this going for you in its full capacity. Hope this helps!

Patrick McIntire at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.