HOWTO Add Google Analytics into webshop?

How to add Google Analytics into webshop?

1) Open analytics account

2) Configure profile (in Google Analytics):
* Set host: www.example.com
* Set default page: PublishedService
* Set time zone: Your Country
* E-commerce Website: YES

3) Add setup code to bottom of framefree template
* In admin menu go to Visual->Themes->Structure->FrameFree.
* Copy-paste code just before </body> tag.
* Click Accept-button
* Remember to change the Analytics website profile id (UA-XXXXXXX-X) from below.

<!-- start Google Analytics -->
<script type="text/javascript">
// Configuration
var wsb_google_analytics_tracker_id = "UA-XXXXXXX-X"; // Website profile id you got from Google
var wsb_currency = "€"; // Currency (if changed, make sure it's typed in UTF-8)
</script>

<form action="#" style="display:none;" name="wsgaform"><textarea cols="5" rows="5" id="wsgametadata">
$theme$;=;$page_id$;=;$page_name$;=;$group_name$;=;
$group_path_plain$;=;$product_itemcode$;=;$product_name$
</textarea></form>

<script type="text/javascript">
// Includes JavaScript files
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"));
var wsbJsHost = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Cscript src='" + wsbJsHost + "wosbee.com/files/wsb_ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
// Initiates the tracker and tracks the page
try {
var pageTracker = _gat._getTracker(wsb_google_analytics_tracker_id);
var wga = new WSGoogleAnalytics(pageTracker);
wga.trackPage();
} catch(err) {}
</script>
<!-- end Google Analytics -->

4) Add transaction report codes into Payment Confirmation WAE -options
* Your payment confirmation page has a special element (WAE, Workspace Action Element) which outputs text according to an end status of order process. Make the following changes to your payment confirmation element.

* To 'order accepted' and 'order pending' add:

<!-- start Google Analytics transaction reporting -->
<form style="display:none;" name="wsgapayresultform"><input name="wsgapayresult" id="wsgapayresult" value="success"></form>
<form style="display:none;" name="utmform">
<textarea id="utmtrans">
UTM:T|$order_id$||$order_total_no_currency$|$order_total_vat$|$order_delivery_cost$|$order_answer_city$||$order_answer_country$
#block order_cart
UTM:I|$order_id$|$item_code$|$item_name$||$item_price$|$item_quantity$
#endblock
</textarea>
</form>
<!-- end Google Analytics transaction reporting -->

* To 'order cancelled':

<!-- start Google Analytics transaction reporting -->
<form style="display:none;" name="wsgapayresultform"><input name="wsgapayresult" id="wsgapayresult" value="cancel"></form>
<!-- end Google Analytics transaction reporting -->

* To 'order failed' and 'invalid checksum':

<!-- start Google Analytics transaction reporting -->
<form style="display:none;" name="wsgapayresultform"><input name="wsgapayresult" id="wsgapayresult" value="fail"></form>
<!-- end Google Analytics transaction reporting -->

5) Collect & analyze valuable information

References:
* Google Analytics Installation Guide
* http://www.google.com/support/googleanalytics/bin/answer.py?answer=66983...
* http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=40932

Campaigns:
* Follow Google's own instructions: http://www.google.com/support/analytics/bin/answer.py?answer=55518
* It contains instructions on how you should link to the site so that Google knows how to pickup campaigns to reports. This will enable you to see for example how many products have been bought after clicking some campaign link. Google's instructions also include a useful tool, a URL Builder tool for creating campaign links http://www.google.com/support/analytics/bin/answer.py?answer=55578&hl=en