Google Analytics: How do I pull all these values?
Posted: Thu Jun 11, 2009 7:08 am
We want to use a more complete analytics script on our goal page( ReceiptPage.ascx ), but I am pretty lost trying to put all of these values together in one place.
The script requires values, such as taxes, which are not present on the order object alone. On this page, taxes are pulled through a separate control( OrderTotalSummary.ascx ), and I dont know how to access these values from a separate codefile.
The second problem I could use some help with is how to iteratively insert javascript with order item information inserted each cycle.
This is the code that needs to be used.
I know how to get the values for order-id and a few similar things, but taxes, shipping, city, etc. cant be pulled directly from the order object.
For the second part, i dont know where to begin. Do I write a for loop in the codebehind and somehow inject the code? Do i use a javascript loop and pull the values sequentially for each item? Can C# and JS work together like this?
Any Advice would be appreciated.
The script requires values, such as taxes, which are not present on the order object alone. On this page, taxes are pulled through a separate control( OrderTotalSummary.ascx ), and I dont know how to access these values from a separate codefile.
The second problem I could use some help with is how to iteratively insert javascript with order item information inserted each cycle.
This is the code that needs to be used.
Code: Select all
<script language="javascript" type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-1");
pageTracker._trackPageview();
pageTracker._addTrans(
"order-id", // required
"affiliate or store name",
"total",
"tax",
"shipping",
"city",
"state",
"country"
);
pageTracker._addItem(
"order-id", // required
"SKU",
"product name",
"product category",
"unit price", // required
"quantity" //required
);
pageTracker._trackTrans();
</script>
For the second part, i dont know where to begin. Do I write a for loop in the codebehind and somehow inject the code? Do i use a javascript loop and pull the values sequentially for each item? Can C# and JS work together like this?
Any Advice would be appreciated.