.. index::
   single: Analytics
   single: Google; analytics

==========
Analytics
==========

One very important capability that's needed in order to run any kind
of eCommerce solution effectively is quality analytic capabilities.  Satchmo
does not have a set of its own analytical capabilities, but it does have
support for using `Google Analytics`_.

In order to use Google analytics, you must have an analytics id, which you can get
for free for registering with Google.  Once you get this tracking code, you must 
enable it in the store by modifying the Site Setting to include the google code.

After enabling Google analytics, you will need to make sure that your analytics
account has the "Yes, an Ecommerce website" is selected in the analytics site's
setting. Additionally, you can select the "Do track site search" in order to view
what people are searching for. Enter "keywords" in the query parameters search field.

Now, all of your pages will be tracked via google analytics.  Satchmo also includes
the additional ecommerce tracking codes so that purchases from your store can be
tracked via analytics.

The google analytics code is implemented using 2 template tags.  By default, they are
included in the base.html and checkout/success.html pages.  If you wish to alter your
templates, use {% show_tracker is_secure %} to implement the tracking code and {% show_receipt %} 
to implement the purchase tracking capabilities.  The show_tracker code must be within
the <body> tags and must be before the show_receipt tags.

One final note on the google analytics capability.  The actual code that is inserted
in your web page is controlled by the two templates in the google-analytics templates
directory.  If you would like to host the google analytics javascript file on your
own server (make sure you know what this means for keeping it updated), you can
just modify these templates.

.. _Google Analytics: http://www.google.com/analytics/
